Macro to delete records in a table...

G

Guest

I have a macro that emptys a table, before repopulating the table with append
queries. What is the best way to have a macro empty a table?

Currently I am using the sendkeys command to select all records and then
delete. This works, however there are problems with this when the user
changes active windows while the macro is running.
 
K

Ken Snell [MVP]

Create a delete query that will delete the records in that table. Save it.

Then use OpenQuery action in macro to run that query.

If you want to avoid the "warning: you're about to delete....." message,
precede the OpenQuery action with SetWarnings action (set the argument to
No).
 

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