Results 1 to 4 of 4

Thread: Execute code automatically

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2005
    Posts
    13

    Question 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?

  2. #2
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    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

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2005
    Posts
    13

    Talking Re: Execute code automatically (Resolved)

    Thanks Woka..it worked..If we put code in Form_Activate, it works..thanks a lot!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width