Clearing a table

  • Thread starter Thread starter X
  • Start date Start date
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
 
Put this code in the OnClick event of a button on your form:

DoCmd.SetWarnings False
DoCmd.RunSQL ("DELETE * FROM NameOfTable;")
DoCmd.SetWarnings False
 
Yes, Thanks. I copied and pasted but forgot to change False to True in the last
line of code.

Appreciate you catching this!
 
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!
 
Back
Top