Click a button on another form

Smee

Registered User.
Local time
Today, 11:09
Joined
Dec 16, 2003
Messages
69
As part of the system I'm building I use the pop-up property for all forms. As I close one particular form I want it to 'click' a button on the form beneath it.

I've pressed a button with another button before with :

buttonName_click

and I've accessed data from another form with :

forms![formname]![controlname].value

and I'm guessing that there is a way to combine these to do what I want but I can't find it.

Any and all help greatly appreciated as usual.

Thanks
 
I suppose an alternate method is to create a function/sub in your main form that does the code that's run by the button click and tell the button to call that function/sub.

Then you should be able to call that function/sub from the other form via

Forms_frmMyFormNameHere.MySubOrFunction
 
have you tried this syntax?

Forms("formname").ButtonName_Click

That's the collection of currently opened forms. Note that normally event procedures are Private... you'd have to make that button's event procedure Public to call it from another form's module.
 
Thanks for your swift replies guys.

Scottn: I tried your way first but it gave me a run time error (no. 2465)

"Application defined or object defined error"

However your solution helped me out in another area I was having
problems so big thanks.

ReAn : Tried yours next and it seems to have worked. Thanks very much for
that one.

Cheers
 

Users who are viewing this thread

Back
Top Bottom