B bpdavis Registered User. Local time Today, 05:17 Joined Jun 15, 2001 Messages 11 Jun 27, 2001 #1 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!
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 Registered User. Local time Today, 00:17 Joined Jun 19, 2000 Messages 49 Jun 27, 2001 #3 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
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
G Garswood Registered User. Local time Today, 05:17 Joined Jul 12, 2001 Messages 11 Sep 10, 2001 #4 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
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
R Rich Guest Sep 10, 2001 #5 It will not you've forgotten the parenthesis after date should be DateAdd("d", -3, Date())
joeyreyma MSCEmbalmer Local time Today, 05:17 Joined Jul 3, 2001 Messages 78 Sep 11, 2001 #6 with or without parenthesis, Garswoods' code will still run.