Clearing a table

X

X

Can anyone help me to figure out how to delete all the
records in a table from a form? Thank you for any help.

X
 
P

PC Datasheet

Put this code in the OnClick event of a button on your form:

DoCmd.SetWarnings False
DoCmd.RunSQL ("DELETE * FROM NameOfTable;")
DoCmd.SetWarnings False
 
P

PC Datasheet

Yes, Thanks. I copied and pasted but forgot to change False to True in the last
line of code.

Appreciate you catching this!
 
T

TC

Also the form should Me.Requery :)

TC


PC Datasheet said:
Yes, Thanks. I copied and pasted but forgot to change False to True in the last
line of code.

Appreciate you catching this!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top