table lock prevents delete query from running

Q

quack

Hi, I am working on a simple data entry continuous form. The user will enter
howver many data records as necessary into this form, then run a macro by
pressing a button on the form; the macro does the following:

1. closes the form
2. appends the data in the table tied to the continuous form to a master table
3. deletes the information in the table tied to the continous form

The problem I am having is when I run this macro from the form using a
command button, it fails while attempting to run the delete query. The error
message is:

"The database engine could not lock table 'MyTableName' because it is
already in use by another person or process."

However, if I run the macro from the "Macros" window in the Objects pane, it
runs as intended with no errors.

Funny thing is, though I've not much experience with Access, I've set up
forms like this one before that worked fine--so it's probably something
stupid and simple that I'm doing wrong. Anyway, any help on this matter is
greatly appreciated.
 
T

Tom van Stiphout

On Sun, 11 May 2008 16:56:00 -0700, quack

I'm not sure, but I would try after step 1:
DoEvents

This should ensure the form is fully closed before step 2 runs.

-Tom.
 
Q

quack

How do I use DoEvents exactly?

Tom van Stiphout said:
On Sun, 11 May 2008 16:56:00 -0700, quack

I'm not sure, but I would try after step 1:
DoEvents

This should ensure the form is fully closed before step 2 runs.

-Tom.
 

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