Link to home
Start Free TrialLog in
Avatar of vbnetcoder
vbnetcoder

asked on

delete the contents of a table

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

Link to home
membership
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
vbnetcoder

ASKER

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.
ty