[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 211
  • Last Modified:

GoToControl of a button in another form

I have a Pop Up form where I would like to have a command button that performs a SendKey function to put the control on a command button on the MAIN FORM.

I tried              "DoCmdGoToControl "forms!Main!button"   that didnt work

Can this be done???
  • 2
1 Solution
Chuck WoodCommented:
Try this:


(This may not work if you have a modal form that will not allow the focus to be placed anywhere but itself.)

If you are attempting to execute the command button on the Main form, then you will have to expose the command button's click event (change from private sub to public sub).
Next, in your pop-up form code, call the event, Forms("Main").Command0_Click.
jfilmore33Author Commented:
So, i changed the Private to Public, but what code do I use in the pop ups OnCLick Event to to perform the Main forms Action???
If you are looking to kick off the Main form's command button event, then
   Forms("Main").Command0_Click     ' where Command0_Click is the command button's click event.

It's no different than calling a public function in a global module.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now