Programming help

B

Belle Sweet

Can anyone help me!!!
I need the code that would delete entries in my database
after they are there for a specified amount of time. I
have a field called days posted.
Thanks
Belle
 
H

Heiko

Dear Belle,
someone told my driving a car
now i have a steer, four wheels, a key and many streets to drive
through.
Can you help me ?
plz describe when to delete and in which form you will implement such
a thing, the Tablename...
e.g. When Field [days posted] is two weeks ago then delete those
records in Table <Contacts> without any user-interaction.
BTW a simple one is
Docmd.Execute "DELETE * FROM <tablename> WHERE [days posted]<#" Date()
& "#"
Heiko
:)
 
T

Tim Ferguson

I need the code that would delete entries in my database
after they are there for a specified amount of time.

DELETE FROM MyTable
WHERE MyTable.DatePosted < #2003-05-01#;


or if you wanted to get really fancy,

DELETE FROM MyTable
WHERE MyTable.DatePosted < DateAdd("d",-30,Date());


Hope that helps


Tim F
 

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