Link to home
Start Free TrialLog in
Avatar of vbnetcoder

asked on

delete the contents of a table

How would i delete the contents of a table?
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
<No Points wanted>
In front of all "destructive" code you should consider inserting some sort of "are you sure?" logic

Something roughly like this:

Dim strSQL as string
strSQL = "DELETE FROM yourTAble WHERE [SomeField] = 3"
If msgbox("Delete all records permanently, ...are you sure?, vbyessNo+vbquestion)=vbNo Then
    exit sub
end if
Currentdb.execute strsql, dbfailonerror 

Open in new window

Avatar of vbnetcoder


This is a table that i am going to be deleting from a lot.  Should i use delete something else?
So this is basically a temporary table that you write data to occasionally?

See my original post.