Code to automatically trigger a command button when a form is opened

JohnLee

Registered User.
Local time
Yesterday, 21:51
Joined
Mar 8, 2007
Messages
692
Hi Folks,

I hoping someone can help me here, I have a form that has a command button on it, which once the form is opened automatically triggers a command button to run the code behind it.

Basically I have design a progress bar, and the code behind the command button works fine, but the problem is that I want the code behind that button to run once the form has been opened without having to physically click that button.

I tried placing the code in the form on load event, the code ran, but the progress bar did not display! I then tried placing the code in the form on open event and the same thing happened.

So I guess the code needs to remain behind the command button. So what I now need to have some code trigger the code behind the command button by telling the command button that it has been clicked, which will then run the code.

I hope I have explained this well enough, if anyone is able to help me here, I would be most greatful.

John
 
Would OnTimer event be OK and with a condition that only allowd it to run once, as in when the form opens. Could be an unbound text box and the code makes and entry and the condition of the OnTime running is the text box is null....which it will be if you close and reopen the form.
 
Hi,

Thanks for that suggestion, that worked a treat. placed the code into the ontimer event and set the timer interval to 1000.

Cheers

John
 

Users who are viewing this thread

Back
Top Bottom