PC Review


Reply
Thread Tools Rate Thread

Date calculation in a Query

 
 
Ioia
Guest
Posts: n/a
 
      27th Nov 2009
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


 
Reply With Quote
 
 
 
 
John Spencer
Guest
Posts: n/a
 
      27th Nov 2009
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

Ioia wrote:
> 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
>
>

 
Reply With Quote
 
Ioia
Guest
Posts: n/a
 
      4th Dec 2009
Thanks again! Both options worked perfectly
You are a genius
Ioia

"John Spencer" wrote:

> 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
>
> Ioia wrote:
> > 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
> >
> >

> .
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Date calculation in query Allen Browne Microsoft Access Queries 2 24th Oct 2008 04:09 PM
Date Calculation in a query Ant Microsoft Access Queries 1 8th Mar 2006 07:38 PM
Date calculation query =?Utf-8?B?cmlnYnk=?= Microsoft Access Queries 5 3rd Jan 2006 05:43 PM
Date Calculation in a query =?Utf-8?B?SmVzc2ljYQ==?= Microsoft Access Queries 8 9th Nov 2005 07:17 PM
calculation on a MAX(DATE) query =?Utf-8?B?ZGF2aWRnMjM1Ng==?= Microsoft Access Queries 5 30th Nov 2004 07:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:12 AM.