Do I need to put any type of pause in the code below?

  • Thread starter Thread starter Walter Steadman
  • Start date Start date
W

Walter Steadman

In the code below, does each line execute before the next begins? If not,
do I need to put some kind of command that makes it wait?

Private Sub Form_Open(Cancel As Integer)
CurrentDb.Execute "uqryStartDateCurrYear", dbFailOnError
CurrentDb.Execute "uqrySetStartDate", dbFailOnError
CurrentDb.Execute "uqryActive", dbFailOnError
CurrentDb.Execute "uqryActiveHours", dbFailOnError
CurrentDb.Execute "uqry1stsemiFalse", dbFailOnError
CurrentDb.Execute "uqry1stSemi", dbFailOnError
End Sub
 
No pause is needed. The first query will complete execution before the next
one begins.

If you want to be able to rollback the results of the previous queries if
one of the later ones faily, you might want to wrap the entire operation in
a transaction. For a discussion and example of do that and avoid the traps,
see:
http://allenbrowne.com/ser-37.html
 
Back
Top