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,
 

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

Top