Auto delete

  • Thread starter Thread starter Jaundice Boy
  • Start date Start date
J

Jaundice Boy

How can you set up a way to press a button on a form and
clear the days data from a pair of tables to allow for
fresh input for the next day.Any assistance would be great.

Thanks ahead of time
Jaundice Boy the yellow livered rum sucker
 
How can you set up a way to press a button on a form and
clear the days data from a pair of tables to allow for
fresh input for the next day.Any assistance would be great.

"fresh input"? You'll never want a historical record of the data? Odd.

Ok, simply create a Delete query for each table. In the button's Click
event either put a Macro that runs the two delete queries, or (better)
VBA code that executes them:

Private Sub cmdCleanout_Click()
Dim db As DAO.Database
Dim qd As DAO.Querydef
On Error GoTo Proc_ERROR
Set db = CurrentDb
Set qd = db.Querydefs("qryDelete1")
qd.Execute,dbFailOnError
Set qd = db.Querydefs("qryDelete2")
qd.Execute,dbFailOnError
Proc_EXIT:
Exit Sub
Proc_ERROR:
MsgBox "Error " & Err.Num & " in cmdCleanout_Click:" & vbCrLf _
& Err.Description
Resume Proc_EXIT
End Sub
 
Back
Top