Execute code automatically
Let me try to explain what I am looking for...
I need to display a dialog box when user click on a 'Start' button of another dialog box. Also along with displaying, I need to invoke a lengthy time consuming processs to initiate automatically in the code of the displayed dialog box. The code inside the dialog box has 'DoEvents' to display statistics of the lengthy run.
I have put the code in the Load function of the dialogbox. Then what is happening the dialog box is not displayed until the code is executed completely defeating my purpose of the dialog box where I inteded to show some statistics.
Now I have to put another button the displayed box and code inside that. Then I have to click it to invoke the lenghty code.
Any geek out there to help me? :cool:
Re: Execute code automatically
Code:
Option Explicit
Private mblnDone As Boolean
Private Sub Form_Activate()
If Not mblnDone Then
'code here
End If
End If
Or in the form load event do Me.Show before you start executing your code.
I prefer the method above though.
Woka
Re: Execute code automatically
hmmmm, not quite sure what you want, but maybe this will work for part of it
put a timer on your form, in the form load set the timer to as short interval, maybe 100 (1 second), long enough for the form to show and enabled then put your lengthy code in the timer event, and timer enabled = false so it doesn't try to repeat.
rgds pete
Re: Execute code automatically (Resolved)
Thanks Woka..it worked..If we put code in Form_Activate, it works..thanks a lot!