Hi Art
The short answer is "no".
However, it is easy to write a short VBA procedure that loops through the TableDefs collection and, for each candidate, execute a DELETE statement:
db.Execute "DELETE FROM [" & tdf.Name & "];", dbFailOnError
Of course, you need to leave system tables alone, and you need to handle relational integrity issues – for example, you cannot delete from Customers because Orders has related records. For a specific database, you can list the table names in an array in the correct order. If you want your code to be general, you could use the TableDef loop and trap the "related records" error, setting a Retry flag and Resume Next. Continue to reset the flag and repeat the loop until you finish and the flag is not set.
Best wishes,
Graham
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Saturday, 9 September 2017 07:13
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] delete all the records from all the tables
Is there a way to delete all the records from all the tables without doing a individual delete statement for each?
Thank you,
Art Lorenzini
SD
Posted by: "Graham Mandeno" <graham@mandeno.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (2) |
Tidak ada komentar:
Posting Komentar