Subtracting days from a date

bpdavis

Registered User.
Local time
Today, 05:17
Joined
Jun 15, 2001
Messages
11
I would like to have a criteria in a query that would take todays date and subtract a number of days from a control on a form. I found a dateadd function but no subtract! ie, this would pull all records in last 30 days.
Thanks!
 
Try this, in the first column of your query select all records. The next column type for a field name:

DateSubtract: Date() - ([Forms]![YourFormName]![YourControlName])

Uncheck the show box, then for critera put:

< 30 (Or < 31 if you want those records too).

Robert
 
This may be useful to others.
Use the DateAdd function but set the value to '-'.
eg.
DateAdd("d", -3, Date)
this will subtract 3 days from todays date
 
It will not you've forgotten the parenthesis after date should be DateAdd("d", -3, Date())
 
with or without parenthesis, Garswoods' code will still run.
 

Users who are viewing this thread

Back
Top Bottom