Forum Discussion
BrianEMcNamee2929
Mar 08, 2022Copper Contributor
Using a Delete Query
I need to create a Delete Query to clear out the data from tables in my database. The description in my Professional Features book is sparse: "DELETE [table,*] FROM tableexpression WHERE Criteria"...
George_Hepworth
Mar 08, 2022Silver Contributor
DELETE *
FROM YourTableNameGoesHere
That will delete every record from the table. Substitute the actual name of your table for "YourTableNameGoesHere"
Please be very sure that's what you want to do because you don't have a do-over.
If you wanted to delete some, but not all, records, you'd add a where clause:
DELETE *
FROM YourTableNameGoesHere
WHERE YourFieldNameGoesHere = SomeValueinEveryRecordToBeDeleted
Again, replace the place-holders with real names of the table and field and the value that determines is records are to be included.
BrianEMcNamee2929
Mar 09, 2022Copper Contributor
George, that is an excellent response. I don't need to be concerned about messing up the database because it's a copy of the original. It cleared up the [table,*] quandary from the Visual Basic Manual and problem of what tableexpression means vs-a-vs table.
- George_HepworthMar 09, 2022Silver Contributor
Not that Microsoft's documentation is a bit on the foggy side.

- BrianEMcNamee2929Mar 09, 2022Copper ContributorGeorge, actually, the Manual's description of everything else was great! I suspect they didn't think anybody'd use SQL for deletions!