macro for deleting records

W

walterISCD

I'm trying to create a macro in Access to delete all the records from a table
and save the empty table to start a new query that will put data in this
table.
In VBA I can't find the command to delete all records.
Can someone help?
Thanks
 
S

Steve Schapel

Walter,

I agree with Pete, you can make a Delete Query to delete all records
from the table. After which you can run this via a macro using the
OpenQuery action. You may want to precede the OpenQuery with a
SetWarnings/No action to suppress the display of the action query
confirmation message.

You seem to be confusing macros and VBA. An alternative in VBA would be
using code like this:
CurrentDb.Execute "DELETE * FROM YourTable", dbFailOnError
 

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