Calling Form Code

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
 
B

Barry Gilbert

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
 
M

Marshall Barton

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.
 
Top