VB Code to Delete Record(s)

D

Dave Elliott

If this form's record(s) date is older than currendate, which is default to
Date()
I need it to delete all records that do not match that criteria.

If TicklerDate < currentdate Then ,(Delete All Records not matching
criteria)


Thanks,

Dave
 
C

Cheryl Fischer

To delete all of the records in a table which have a TicklerDate which is
less than the current date, the following will work:

CurrentDB.Execute "DELETE * from MyTable where TicklerDate < Date()",
dbFailOnError

You can put that code in the Click event of a command button.

hth,
 
Top