bpdavis
06-27-2001, 12:52 PM
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!
Robert Saye
06-27-2001, 02:29 PM
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
Garswood
09-10-2001, 09:40 AM
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())
joeyreyma
09-10-2001, 08:22 PM
with or without parenthesis, Garswoods' code will still run.