I'm a little nervous about slamming my database with a dozen Update queries
in a loop that all modify RecordSources of open forms. Will the use of
DoEvents and/or a Sleep function ameliorate any risk involved in doing this?
Should I include a Requery in the loop after executing each query?
For example:
For each varQry in Array("qryDeleteOldTransactions", _
"qryDeleteClient Acct", etc., etc.)
db.Execute varQry
Next
I have about a dozen queries that I want to run in a loop like this, all
updating (mainly deleting records from) the different tables that are part
of (i.e. included in the queries that are) the RecordSource for currently
open forms.
Should I do this:
For each varQry in Array("qryDeleteOldTransactions", _
"qryDeleteClient Acct", etc., etc.)
db.Execute varQry
DoEvents
Forms("frmMain").Requery
Next
What about this:
Private Declare Sub Sleep _
Lib "kernel32" ( ByVal dwMilliseconds As Long )
For each varQry in Array("qryDeleteOldTransactions", _
"qryDeleteClient Acct", etc., etc.)
db.Execute varQry
Forms!frm0.Requery
DoEvents
Sleep 500
Forms("frmMain").Requery
Next
Other options?
Thanks in Advance.