Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

deleting object at the end of a macro

Status
Not open for further replies.

phil009

Technical User
Jun 2, 2004
63
US
I have a problem with the macro that I am running. At the start I import a table and then I run a query on it at the end I want to delete the table but when I try "DeleteObject" it always comes up as an error and says that Access could not lock the table because some other user is using it. But I know this isn't true because immediately after I am able to click on it and it will delete just fine. If anybody knows what I am doing wrong the help would be much appreciated.
Thanks,
Phil
 
I would guess that you are the person who is using it.
I think that As soon as the query is initiated the next command runs.
So the delete command is running before the query has finished.
Somehow you need to put a delay into your macro before the deleteobject runs. I'm not sure how to do this in a macro.
I guess(!) that you could use the RunMacro action to run another macro displaying an hourglass (or doing nothing ) several hundred times but if you are avble to write code then you could write a simple do nothing loop and run that.
 
Have you tried to launch an action query like this:
DROP TABLE theTable;

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
thanks both of you, i finally go it thanks to your help.

Phil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top