When performing several SQL queries in succession (through VBA), the queries are pulling the wrong number of records. However, when exact same queries are run manually, they pull the correct number or records.
I have never encountered this before. Has anyone come across this, or know of a solution?
I've tried the following:
DoEvents
DoCmd.RunSQL "query1"
DoEvents
DoCmd.RunSQL "query2"
DoEvents
DoCmd.RunSQL "query3"
CurrentDB.Execute "query1"
CurrentDB.Execute "query2"
CurrentDB.Execute "query3"
DoCmd.RunSQL "query1"
DBEngine.Idle
DoCmd.RunSQL "query2"
DBEngine.Idle
DoCmd.RunSQL "query3"
DBEngine.Idle
All to same effect. Wrong output when running in automated script.
I have never encountered this before. Has anyone come across this, or know of a solution?
I've tried the following:
DoEvents
DoCmd.RunSQL "query1"
DoEvents
DoCmd.RunSQL "query2"
DoEvents
DoCmd.RunSQL "query3"
CurrentDB.Execute "query1"
CurrentDB.Execute "query2"
CurrentDB.Execute "query3"
DoCmd.RunSQL "query1"
DBEngine.Idle
DoCmd.RunSQL "query2"
DBEngine.Idle
DoCmd.RunSQL "query3"
DBEngine.Idle
All to same effect. Wrong output when running in automated script.