date parameter problem

G

Guest

I am trying to create a report that pulls data from a query. In the query I want to set up a parameter that the user will put in last monday's date and the report will print the data for that monday plus the rest of the week until sunday, essentially 7 days. I did have >Date()-7 that I used when I printed the report every monday. Now if I print it on tuesday instead it will give me the dates for last tuesday thru monday, again 7 days but the wrong days.
How can I create this so I can get the last 7 days or just Monday thru Sunday of the previous week.

Thanks,

John
 
A

Allen Browne

Try:
Date() - Weekday(Date(), 2) + 1

The 2 specifies Monday should be counted as the first day of the week.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

John Daily said:
I am trying to create a report that pulls data from a query. In the query
I want to set up a parameter that the user will put in last monday's date
and the report will print the data for that monday plus the rest of the week
until sunday, essentially 7 days. I did have >Date()-7 that I used when I
printed the report every monday. Now if I print it on tuesday instead it
will give me the dates for last tuesday thru monday, again 7 days but the
wrong days.
 

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