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.
Tom van Stiphout - 12 May 2008 03:47 GMT
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.
>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
[quoted text clipped - 18 lines]
>stupid and simple that I'm doing wrong. Anyway, any help on this matter is
>greatly appreciated.
quack - 12 May 2008 20:01 GMT
How do I use DoEvents exactly?
> I'm not sure, but I would try after step 1:
> DoEvents
[quoted text clipped - 25 lines]
> >stupid and simple that I'm doing wrong. Anyway, any help on this matter is
> >greatly appreciated.
Miron4ik - 12 May 2008 07:37 GMT
PPPPPPPPPPPPPPPPPPPPP
> Hi, I am working on a simple data entry continuous form. The user will
> enter
[quoted text clipped - 22 lines]
> stupid and simple that I'm doing wrong. Anyway, any help on this matter is
> greatly appreciated.