Clear Records

  • Thread starter Thread starter Heather
  • Start date Start date
H

Heather

How can I clear records out(delete)from my tables before
re-populating new data in. Do I have to create Delete
queries for each table and call the query in the code?
 
How can I clear records out(delete)from my tables before
re-populating new data in. Do I have to create Delete
queries for each table and call the query in the code?

Well, you probably could use a loop like

For Each tdf In db.Tabledefs
' can't remember the name of the actual constant --
' you'll have to check it...
If tdf.Attributes And dbLocalTable Then
strSQL = "DELETE FROM " & tdf.Name & " WHERE TRUE"
db.Execute strSQL, dbFailOnError

End If
Next tdf

but you'd probably feel safer doing it by hand, wouldn't you? You probably
don't want to empty your look up tables or parameter tables etc. Come to
think of it, I'd be doing the whole thing in the GUI!

HTH


Tim F
 
You could do any of the following:

Create different delete queries, and have a macro run each
Have a macro with the RunSQL statements - "Delete from
TableName"
Use code:

CurrentDB.Execute "Delete From Table1"
CurrentDB.Execute "Delete From Table2"
etc.

Or any number of other ways.


Chris Nebinger
 
Back
Top