The code below loops through a table of query names. It displays the query name in the text box Me.txtID and then executes the query. Finally it moves to the next record and loops. It works as predicted so long as the message box is present. However, when I comment out the message box, all the queries are run but the me.txtID box is only updated on every 4-5 records. Every query requires at least 5 seconds to execute when launched from Access Database Window.
QUESTION: In this procedural code, when the DoCmd.OpenQuery is executed, is the next line of code executed immediately or after the launched query completes? If immediately then I could have a problem.
If query #2 is dependent on the results of query #1 and query #1 requires 30 seconds to complete execution, then query #2 will probably begin before query #1 is complete.
Is there a DoCmd.? property I can test to see if the command is complete?
Any insight is appreciated -
Do While Not rs.EOF()
' Display the name of the query
Me.txtID.Value = rs("CreateTableQueryName")
' Next run the Create Table Query
If IsNull(rs("CreateTableQueryName")) Then
' skip it