A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

date expression to bring up a weeks worth of records



 
 
Thread Tools Display Modes
  #1  
Old November 27th, 2006, 06:17 PM posted to microsoft.public.access.queries
chris
external usenet poster
 
Posts: 2,039
Default date expression to bring up a weeks worth of records

i have my new data base built but for the love of god can i get the
expression right this.

in my query i need, when prompted it asks for a date, and when i put in
21/11/06, i want it to bring up all records for that week( monday to sunday).
can anyone 1 help plz.


Thank you.

Chris
  #2  
Old November 27th, 2006, 06:45 PM posted to microsoft.public.access.queries
kingston via AccessMonster.com
external usenet poster
 
Posts: 620
Default date expression to bring up a weeks worth of records

Use a Between criteria with the function Weekday():

Between [InputDate]-Weekday([InputDate])+1 AND [InputDate]+7-Weekday(
[InputDate])

Chris wrote:
i have my new data base built but for the love of god can i get the
expression right this.

in my query i need, when prompted it asks for a date, and when i put in
21/11/06, i want it to bring up all records for that week( monday to sunday).
can anyone 1 help plz.

Thank you.

Chris


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/200611/1

  #3  
Old November 27th, 2006, 07:15 PM posted to microsoft.public.access.queries
chris
external usenet poster
 
Posts: 2,039
Default date expression to bring up a weeks worth of records

hi, thanks for the quick response, but if wont let me use it as its "too
complex" or typed in correctly. any other suggestions plz

Thank you

"kingston via AccessMonster.com" wrote:

Use a Between criteria with the function Weekday():

Between [InputDate]-Weekday([InputDate])+1 AND [InputDate]+7-Weekday(
[InputDate])

Chris wrote:
i have my new data base built but for the love of god can i get the
expression right this.

in my query i need, when prompted it asks for a date, and when i put in
21/11/06, i want it to bring up all records for that week( monday to sunday).
can anyone 1 help plz.

Thank you.

Chris


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/200611/1


  #4  
Old November 27th, 2006, 07:50 PM posted to microsoft.public.access.queries
kingston via AccessMonster.com
external usenet poster
 
Posts: 620
Default date expression to bring up a weeks worth of records

In your query, this should go in the criteria for the date field. Make sure
to reformat this if the posting is broken up. Additional parentheses may
help Access digest it:

Between ([InputDate]-Weekday([InputDate])+1) AND ([InputDate]+7-Weekday(
[InputDate]))

Otherwise, simply use the mathematical comparators =.

Also, is your system set up to show dates in the format day/month/year rather
than month/day/year? Is this how data is recorded in the table?

Chris wrote:
hi, thanks for the quick response, but if wont let me use it as its "too
complex" or typed in correctly. any other suggestions plz

Thank you

Use a Between criteria with the function Weekday():

[quoted text clipped - 11 lines]

Chris


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/200611/1

  #5  
Old November 27th, 2006, 08:34 PM posted to microsoft.public.access.queries
fredg
external usenet poster
 
Posts: 4,386
Default date expression to bring up a weeks worth of records

On Mon, 27 Nov 2006 09:17:02 -0800, Chris wrote:

i have my new data base built but for the love of god can i get the
expression right this.

in my query i need, when prompted it asks for a date, and when i put in
21/11/06, i want it to bring up all records for that week( monday to sunday).
can anyone 1 help plz.

Thank you.

Chris


Add a new column to your query.
WeekOfatePart("ww",[DateField])

As criteria on this column, write:
DatePart("ww",[Week of what date? mm/dd/yyyy])

I notice you are using a non-US date format.
The date, when prompted, MUST be entered in the US format of
month/day/year unless the date is unambiguous. A date of 2/5/2006 is
ambiguous. It could be Feb 5 or May 2.

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.