Trigger or Call a mouse-click on another form (1 Viewer)

Local time
Today, 16:40
Joined
Aug 3, 2005
Messages
66
Hello.

I am trying to simulate a mouse-click of a cmdbutton on another form, or call the Click event of a cmdbutton on another form.

From Form1, I want to "click" a cmdbutton which is located on another form.

Here's what I have so far:

Form1 is Open. A cmdbutton on Form1 has the following code:

DoCmd.OpenForm "Form2"
Forms!Form2.Form!mycmndbtn.SetFocus
Call Forms.Form2.mycmndbtn_Click
DoCmd.Close acForm, "Form1"

Access Error: "Application-defined or object-defined error"

Debug shows error is pointing to this line in the code:
Call Forms.Form2.mycmndbtn_Click

Any help is appreciated.

Thank you kindly,
Jamie.
 
Local time
Today, 16:40
Joined
Aug 3, 2005
Messages
66
Thank you.

As RuralGuy said:

"...your Click procedure needs to be Public rather than Private..."

So it was the PUBLIC vs PRIVATE thing.

Thanks again.
 

Users who are viewing this thread

Top Bottom