The database could not lock table

D

Dirt Bike

So I have a table in a subform on a form. I knew I couldn't do anything with
the table straight away. So I wrote code to close the form. But I still get
the dreaded error about the inability to lock the table.
Here is my code: (please, don't laugh)

DoCmd.Close

MsgBox "OK, I had to close this form and pause just a second", vbOKOnly,
"That is a big 10-4 buddy!"


DoCmd.SetWarnings False
DoCmd.OpenQuery "QF-DG-BF", acViewNormal, acEdit
DoCmd.OpenQuery "QF-JB-BF", acViewNormal, acEdit
DoCmd.OpenQuery "QF-JS-BF", acViewNormal, acEdit
DoCmd.OpenQuery "QF-MB-BF", acViewNormal, acEdit
DoCmd.OpenQuery "QF-SC-BF", acViewNormal, acEdit
DoCmd.OpenQuery "QF-SW-BF", acViewNormal, acEdit
DoCmd.OpenQuery "QF-UN-BF", acViewNormal, acEdit
Beep
MsgBox "OK, built the new FORECAST form the existing sheets in
W:\OEM\forecast", vbOKOnly, "That is a big 10-4 buddy!"



stDocName = "Loc3Master"
DoCmd.OpenForm stDocName, , , stLinkCriteria

When I manully close the form and manually run the macro that builds the
table it works but the above code doesn't.
 
G

Gina Whipp

Dirt Bike,

I am wondering if DoCmd.Close is closing the table, where do you have it on
the Main form or the Subform? Also, when do you get the error? Do the
queries run and then you get the error or before the quesries even run?
What kind of queries are they? Append, Update??? Is 'Loc3Master' the Main
form?

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top