delete query ?

jarheadjim

Registered User.
Local time
Today, 11:54
Joined
Mar 6, 2002
Messages
83
i want to set up a query that, when run, deletes all records older than 90 days...I created a delete query, and under my field that is associated with date the criteria is "<now()-90", but it didn't work. did i do something wrong?
 
<Now()-90 does work (without the qoutes). If you put qoutes in take them out. If not the problem is somewhere other than your criteria for the query.
HTH
Edit - This assumes your field is set up as a Date/Time format

[This message has been edited by Jerry Stoner (edited 04-18-2002).]
 
Right. Thanks Pat.
 
even though i used now() for the date field that that is being queried?

should i go back and change it to date()?
 
Yes you probably should. As Pat pointed Now() MAY work but Date() is correct and will ensure you dont run into problems later.
 
It's deleting all records now, not just the ones older than 90 day
frown.gif
. Should the dateadd function be used? If so, how?

thanks again, I'm such a newbie :P
 
Just tried <Date()-90 and it worked fine. Any ideas anyone else?
 
I just realized that it's putting " around 90 after i enter the criteria, and if i take them out, they just come back again. Do I have a setting wrong somewhere?
 
Check your properties in the table. Ill bet your field is Text not Date/Time.Set to Date time and in Format set it up the way you want. I usually use short date.
 
OMG, that was it! I can't believe I overlooked it. Thank you so much.

jim
 

Users who are viewing this thread

Back
Top Bottom