Full Version: Call a function from one form that is on another form
UtterAccess Forums > Microsoft® Access > Access Forms
awolterm
Hi all,
Way I have form A that has a function to open a form B from there, which grabs data from the record that is selected on form A. Off of A I can open another form, Form C, that similary uses grabs the record data from form A, thus the record that I want to deal with is selected.
Is there a way from Form C that I can call the open form command of form B off of Form A?
Hopefully that is clear enough...
Thanks for all the help guys.
Sligo
Yes.
First, change the "Private" scope designator on the function to "Public." This allows other objects to use it (as long as the form is open.)
To actually use it, you do it the same way you access a field on that form:
forms!FormA.cmdOpenB_Click
I hope this helps.
- Sligo
datAdrenaline
Do you really need to have the forms open? ... What I am driving at is that you are have indicated that you are getting record information from these forms, do your users then interact with these forms?, or are you just opening them to get data, then closing them once you've got that data?.
If you are opening, getting data, then closing ... there is a better way using recordsets ...
...
Otherwise ... in addition to Sligo's suggestion, you may consider moving your code from FormA into a Standard module. Then FormA does not have to be open to use it ...
One more thing ... you can take advantage of Intellisense if you refer to the public procedure on FormA through its class ... like this:
Form_FormA.cmdOpenB_Click
Using this syntax will actually instantiate FormA if its not already open.
awolterm
The users would be interacting with them.
Thanks for the help guys.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.