Calling Procedure in Hidden Form

  • Thread starter Thread starter Stu
  • Start date Start date
S

Stu

What is the syntax for calling an event procedure in a hidden form from a
visible (current) form?

My hidden form has two procedures: form_open and Closebutton_click. I
assume when I open the hidden form the form_open procedure is run. I want to
run the Closebutton_click procedure in the hidden form when a certain event
occurs on the visible (current) form. The CloseButton_click will run some
code and then close the hidden form.
 
On Wed, 7 Apr 2010 06:26:06 -0700, Stu <[email protected]>
wrote:

You can make that procedure Public rather than the current Private.

But much better is to move that code to the Form_Close event so it
runs regardless of how the form is closed. Then in the other form you
can simply use:
DoCmd.Close acForm, "myOtherFormName"

-Tom.
Microsoft Access MVP
 
Got it. Thanks Marshall

Marshall Barton said:
Stu said:
What is the syntax for calling an event procedure in a hidden form from a
visible (current) form?

My hidden form has two procedures: form_open and Closebutton_click. I
assume when I open the hidden form the form_open procedure is run. I want to
run the Closebutton_click procedure in the hidden form when a certain event
occurs on the visible (current) form. The CloseButton_click will run some
code and then close the hidden form.


Make sure the button's Click event procedure is Public.
Then you can use either:

Forms![hidden form].Closebutton_click
or
Call Forms![hidden form].Closebutton_click()
 
What is the syntax for calling an event procedure in a hidden form from a
visible (current) form?

My hidden form has two procedures: form_open and Closebutton_click. I
assume when I open the hidden form the form_open procedure is run. I want to
run the Closebutton_click procedure in the hidden form when a certain event
occurs on the visible (current) form. The CloseButton_click will run some
code and then close the hidden form.

Make sure the sub procedure is set to Public (instead of Private).
Both forms must be open.

To call it from another form:
Call Forms("FormName"). CloseButton_Click

To call a sub procedure on a sub form, use:

Call Forms("FormName").SubformControlName.Form. CloseButton_Click

Substitute the actual name of your main form where it says "FormName".
Substitute the actual name of the subform control on the main form
which holds the sub form (not the name of the form used as the
subform) where it says "SubformControlName".
 
Back
Top