Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Pausing VB Code in Microsoft Access 97

Options
  • 31-05-2004 9:58pm
    #1
    Registered Users Posts: 358 ✭✭


    Can anyone tell me how to pause code in Microsoft Access 97?

    Basically im running code on an on click event that opens a form and then runs a complex query.

    Docmd.OpenForm "Form"
    Docmd.OpenQuery "Query"

    The problem im having is that when the button is clicked the form isnt loaded properly because access runs straight into calculating the query and the form is left half loaded until the query is finished calculating. Strange I know!

    So the only solution I can think of is;

    Docmd.OpenForm "Form"
    Pause Code (For 1-2 seconds until form has loaded)
    Docmd.OpenQuery "Query"

    I have searched through access help files but cant find anything that will do the job.

    Any suggestions/ways around this would be greatly appreciated.

    TIA. ;)


Comments

  • Registered Users Posts: 834 ✭✭✭fragile


    Use the Sleep Win32 API call

    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

    Private Sub Command1_Click()
    ' Do something

    ' Pause for 5 seconds
    Sleep 5000

    ' Do something else

    End Sub


  • Registered Users Posts: 358 ✭✭Philbert


    Ah "Sleep"!!

    After trying "Stop" "Pause" "Hold" "Step Out" "Exit"........I knew it was something along those lines!

    Many thanks..


Advertisement