open a form and run command button code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

okay, i know this sounds a bit whacky, but i am working around someone else's
code, and have a very quick deadline.

what i need to know, is there a way to open a form and run the code that it
has behind a command button, from another form?

i have a main form, that shows a basic view. some buttons on this form need
to open the much more detailed form, and excute code within that form as if
one of those buttons were clicked. in other words, open form, run
commandbutton_click() code.

thanks in advance for any assistance!!
 
* alfaista said:
okay, i know this sounds a bit whacky, but i am working around someone else's
code, and have a very quick deadline.

what i need to know, is there a way to open a form and run the code that it
has behind a command button, from another form?

i have a main form, that shows a basic view. some buttons on this form need
to open the much more detailed form, and excute code within that form as if
one of those buttons were clicked. in other words, open form, run
commandbutton_click() code.

thanks in advance for any assistance!!

I was able to open a form called frmEmployees and push a command button
(cmdNext) on that form successfully using the following code:

DoCmd.OpenForm "frmEmployees"
Forms("frmEmployees").Controls("cmdNext").SetFocus
SendKeys "{ENTER}", True


HTH,
Bob L.
 
thank you thank you!!
forgot all about sendkeys!! works perfect, and fast! thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top