How do I code to delete all records shown in a query

John11

New member
Local time
Today, 09:56
Joined
Apr 10, 2005
Messages
9
I'm having trouble with deleting a whole list of records

I have frmArchive, in that form need a button to be able to delete all records that are in qryArchive (but not delete the actual query)

What code do I write for it to do this?
 
Does qryArchive simply select a group of records?
 
Create a Delete query based on qryArchive.

RV
 
oh right base it on a delete query (never made one before)

thanks it works now
 
And, if you don't know what a Delete Query is then go to Query -> Delete Query when in the edit mode for qryArchive.
 
In general a delete query looks like this:

DELETE * FROM table WHERE criteria ;

If you have a WHERE clause in a SELECT query and that SELECT query shows exactly what you wanted to delete, you can do this...

copy the SELECT query

open it in design mode

change the selected fields to just *

in the iconic toolbar, change the SELECT query to a delete query.

Save it BEFORE you run it.

WARNING: Opening a DELETE query executes the action of the query. I.e. it DELETES things.
 

Users who are viewing this thread

Back
Top Bottom