Date calculation in a Query

I

Ioia

I have this expression in a form and it works perfect
DateAdd("d",63-Weekday(FirstContact,7),FirstContact)
But, where should I write it in a query? The query should show all the items
that shoul be removed from the list on the calculated date, and update the
"removed from the list" the field from there.
Thanks
Ioia
 
J

John Spencer

Add the expression as a calculated field in the query

Field: Removal: DateAdd("d",63-Weekday(FirstContact,7),FirstContact)
Criteria: = #2009-11-27#
Then you can apply criteria against the calculated field.

Another option would be to determine the date range of FirstContact that you
are interested in and apply criteria against firstcontact. That would
probably be something like the following if you were trying to get the records
with a removal date of 27 November. You might have to adjust the -62 and -56
by -7 to get the correct records returned.

Field: FirstContact
Criteria: Between DateAdd("d",-62,#2009-11-27#) and DateAdd("d",-56,#2009-11-27#)

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 

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