A family of Microsoft relational database management systems designed for ease of use.
I agree CurrentDb.Execute is the way to do it !!
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
My reoprt is based upon a query that can not get its data untill the insert statement has written its data to the table. Is there any way to insert about a 5 second delay between the insert statement and the openreort command?
strSQL = "INSERT INTO tbl_Bank(ChangeDate, PlayedAmount, PlayerID) SELECT " & Format(Me.txt_ChangeDate, "#yyyy/mm/dd#") & ", " & Me.txt_Wager & ",PlayerID FROM qry_Bank"
DoCmd.RunSQL strSQL
DoCmd.OpenReport "rpt_GamePlayed", acViewNormal
A family of Microsoft relational database management systems designed for ease of use.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
I agree CurrentDb.Execute is the way to do it !!
There is no need to wait. Instead of using the asynchronous RunSQL method, use the Execute method that doesn't return until the query has completed:
CurrentDb.Execute strSQL, dbFailOnError
You can also use the Sleep() function
Checkout the Timer Function --
This example uses the Timer function to pause the application. The example also uses DoEvents to yield to other processes during the pause.
Dim PauseTime, Start, Finish, TotalTime
If (MsgBox("Press Yes to pause for 5 seconds", _
4)) = vbYes Then
PauseTime = 5 ' Set duration.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents ' Yield to other processes.
Loop
Finish = Timer ' Set end time.
TotalTime = Finish - Start ' Calculate total time.
MsgBox "Paused for " & TotalTime & " seconds"
Else
End
End If