SendKeys?

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

What I am trying to achieve is the following:

The user clicks on a command button which opens a 2nd form, when the 2nd
form is open, a 2nd command button is programatically clicked and an
existing procedure is run.

Is a Sendkeys statement the best way to click the 2nd Command button or is
there a better method?

Advice would be appreciated

TIA
Tom
 
Tom,

The SendKeys method is always the *worst* method for accomplishing anything!
It is notorious for doing anything but what it was intended to do, and
should therefore be avoided at any cost. After all, there is almost always a
better way to do whatever is desired. In your particular case:
* Put the code behind the 2nd command button in a general module; note that
you will have to change any occurrences of the Me. keyword to an absolute
reference like Forms![FormsName].
* Make the 2nd command button call the procedure in the general module
* Add an extra line of code at the end of the procedure behind the first
command button, to call the same procedure caklled by the second command
button. Cahnces aree this Call would be right after the DoCmd.OpenForm in
the 1st button's code.

HTH,
Nikos
 

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

Similar Threads

SendKeys 3
Navigating to another form 1
SendKeys "+{right}" problem 1
Controlling Navigation Pane from a form 1
Add hyperlink button 1
Prev/Next Record coding 1
Page Breaks 1
Return to row on tabular form 3

Back
Top