Macro Fails Due to Table Locked

L

LLFK

I have a standalone form with a page that contains a subform linked to a
query. In order to update the subform data, I created a macro to run several
queries that will ultimately update the query the subform is linked to. In
my macro, I close the main form, run all of the queries and then re-open the
main form with a GoToControl to get it to go right back to the page where the
subform resides. I continue to get an error with my macro that states it
can't run my queries because the table is already in use.

When I manually close the main form and run the macro, it works fine.

Any thoughts?
 
K

Ken Snell \(MVP\)

The form is not closing fast enough for your queries to be able to gain
access to the table. This likely is a timing issue. Any particular reason
you cannot update the data directly in the subform without having to run the
external queries?

Otherwise, you'll need to run a macro to close your current form, open
another form, and then run a macro from that form that will do the updates
(that should ensure that the first form is fully closed).
 

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