Auto delete

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
 
J

John Vinson

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
 

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

Similar Threads


Top