Calling Form Code

  • Thread starter Thread starter Ray
  • Start date Start date
R

Ray

I have a form with several buttons and cotrols that are to be enabled
or disabled based on conditions set elsewhere in the application. In
the beginning, these conditions were all set prior to opening the
form, so all code to check the status of the cotrols exist as code in
the form itself. We are now having to react to changes made in other
forms that may be opened after this form -

SO - how can I call the update code in one form (to refresh controls,
lists, etc) from an action taking place on another form?

Confusing enough??

Other suggestions welcome as well...
Thanks
Ray
 
Ray said:
I have a form with several buttons and cotrols that are to be enabled
or disabled based on conditions set elsewhere in the application. In
the beginning, these conditions were all set prior to opening the
form, so all code to check the status of the cotrols exist as code in
the form itself. We are now having to react to changes made in other
forms that may be opened after this form -

SO - how can I call the update code in one form (to refresh controls,
lists, etc) from an action taking place on another form?

You can declare the update code in a public sub or function. Then call it
from the outside like this:
Forms!DestinationForm.MyUpdateRoutine

The form with the update code in it needs to be open at the time.

Barry
 
Ray said:
I have a form with several buttons and cotrols that are to be enabled
or disabled based on conditions set elsewhere in the application. In
the beginning, these conditions were all set prior to opening the
form, so all code to check the status of the cotrols exist as code in
the form itself. We are now having to react to changes made in other
forms that may be opened after this form -

SO - how can I call the update code in one form (to refresh controls,
lists, etc) from an action taking place on another form?


Any VBA procedure can call any Public procedure in any OPEN
form. The syntax is formobject.procedure with the usual
syntax for arguments.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top