By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,300 Members | 1,789 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,300 IT Pros & Developers. It's quick & easy.

Make table query in a loop gets error: 'The database engine could not lock table...'

P: n/a
I have a make-table query in a FOR loop that outputs to 'table1.'
'table1' is then referenced by 'Form1.' here's the code:

For j = 1 To rsTable.RecordCount

SerialNumRef.Value = rsTable!SerialNum
DoCmd.SetWarnings False
DoCmd.OpenQuery "Query1"
DoCmd.Close acQuery, "Query1"
DoCmd.SetWarnings True

DoCmd.OpenForm FormName:="Form1", WindowMode:=acDialog
'MsgBox "press ok"



If I uncomment the message box, then the code runs fine after pressing
ok. Otherwise I get the message: 'The database engine could not lock
table 'table1' because it is already in use by another person or

As you can see, the windowMode is in acDialog so the code stops until
'Form1' is closed. Why does merely enabling the message box seem to
alleviate the constraint on 'table1?'

Thanks in advance


Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.