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!

trouble deleting all entries in tables 1

Status
Not open for further replies.

kdoran

Technical User
Mar 23, 2003
88
0
0
US
I have a database and want to be able to delete all the entries in the tables with no prompt.

table1
table2
table3


tried various ways with no luck.

What has worked was this
DoCmd.DeleteObject acTable, "table1" but this deletes the actual table and I do not want to do that, just the data in it.

thanks in advance,
 
Try something like the following
Code:
Currentdb.Execute "DELETE * FROM table1", dbFailOnError

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Another way (VBA code):
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE FROM table1"
DoCmd.RunSQL "DELETE FROM table2"
DoCmd.RunSQL "DELETE FROM table3"
DoCmd.SetWarnings True

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks for the help, I will give it a go and let you know!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top