Removing data from DB

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have a database with some data entries. Now I would like to keep the whole
structure (tables, forms, etc.) but get rid of all the old data. Is there a
way to "reset" a db?

Thanks, Thore
 
Thore,

Start by making a *backup copy* of your database.
Then paste the following sub in a general module and run it:

Sub Clear_All_Data()
Dim tbl, strSQL
For Each tbl In CurrentDb.TableDefs
If Left(tbl.Name, 4) <> "MSys" And tbl.Connect = "" Then
strSQL = "DELETE * FROM [" & tbl.Name & "]"
CurrentDb.Execute strSQL
End If
Next
End Sub

HTH,
Nikos
 
Copy and paste the tables. One of the paste options is Structure Only. Or
you could just delete the records in the tables. Other database objects
(forms, queries, etc.) interact with the data in tables, but do not in
themselves contain data, so they can be left alone.
 

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

Back
Top