Date restrictor for this week

G

Guest

Hi,

I want to write a query that will get all records for this week. I have a
similar query for another company which is listed below:

WHERE
(((FrontDeskLogAnna.BusinessDate)>=DateAdd("d",-DatePart("w",Date()),Date())
And
(FrontDeskLogAnna.BusinessDate)<DateAdd("d",8-DatePart("w",Date()),Date())))

The problem is that the company that I am writing this new query for is open
Monday - Saturday. Whenever I run the query using this date restrictor, I
end up getting last Saturday's records as well. So if I ran it today, I get
things from May 6th which is last week. It isn't a problem with the other
company that I use it with because they are open Monday - Friday and closed
on the weekend. Can someone tell me how to modify this to exclude last
Saturday?

Thanks,
 
M

Michel Walsh

Hi,


Use

DatePart("ww", fieldName ) = DatePart("ww", now)


or use optional argument(s) of DatePart to suit your definition of a week.



Hoping it may help,
Vanderghast, Access MVP
 

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