From: Stu on
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.
From: Marshall Barton on
Stu wrote:

>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()

--
Marsh
MVP [MS Access]
From: Tom van Stiphout on
On Wed, 7 Apr 2010 06:26:06 -0700, Stu <Stu(a)discussions.microsoft.com>
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


>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.
From: Stu on
Got it. Thanks Marshall

"Marshall Barton" wrote:

> Stu wrote:
>
> >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()
>
> --
> Marsh
> MVP [MS Access]
> .
>
From: fredg on
On Wed, 7 Apr 2010 06:26:06 -0700, Stu wrote:

> 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".
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail