Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleteing all data from a database...

Status
Not open for further replies.

PogoWolf

Programmer
Mar 2, 2001
351
US
I found this nice piece of code on the netm which will delete all records from a database.

Code:
Declare @sql NVarChar(4000)
Select @sql= isnull(@sql,'') +'Delete From ' + Name + ';' From sysObjects Where xType='U'
Exec sp_executesql @sql

but it's an SQL procedure, is there a way to do this in Access?



The PogoWolf
 
In VBA you may browse the CurrentDB.TableDefs collection and execute on the fly a DoCmd.RunSQL "DELETE FROM " & theTableName instruction.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top