delete the contents of a table

How would i delete the contents of a table?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dale FyeOwner, Developing Solutions LLCCommented:
run a query.  To delete all of the records:

DELETE FROM yourTableName

To delete only selected records:

WHERE [SomeField] = SomeNumericValue


WHERE [SomeField] = "SumTextValue"

If you need to do this from code:

Dim strSQL as string
strSQL = "DELETE FROM yourTAble WHERE [SomeField] = 3"
Currentdb.execute strsql, dbfailonerror

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jeffrey CoachmanMIS LiasonCommented:
<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

vbnetcoderAuthor Commented:
This is a table that i am going to be deleting from a lot.  Should i use delete something else?
Dale FyeOwner, Developing Solutions LLCCommented:
So this is basically a temporary table that you write data to occasionally?

See my original post.
vbnetcoderAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.