button to delete all the records from two tables

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to create a button in a form that would delete the entire contents of two tables while leaving the tables intact?
And how would I go about creating it?

Thanks,
Roger
 
Roger said:
Is it possible to create a button in a form that would delete the
entire contents of two tables while leaving the tables intact? And
how would I go about creating it?

'----- start of "air" code -----
Private Sub cmdEmptyTables_Click()

Dim db As DAO.Database

If MsgBox("Are you sure you want to do this?", _
vbQuestion+vbYesNo, _
"Empty Tables - Are You Sure?") _
= vbYes _
Then
Set db = CurrentDb
db.Execute "DELETE * FROM Table1", dbFailOnError
db.Execute "DELETE * FROM Table2", dbFailOnError
Set db = Nothing
End If

End Sub
'----- end of "air" code -----
 
Back
Top