Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter Dates in current week

Status
Not open for further replies.

gloudo

Programmer
Feb 3, 2002
34
0
0
NL
Hi there,

I like to filter all the records in a query of wich the date is in the current week. And when the week changes the dates of that week must be filtered, and so on.

Can anybody tell me the expression for this query?

thanks :)
 
Use the DatePart Function. In a new column in your query put
MyWeek:DatePart("ww",[DateFieldName])

Then on the criteria line for this column put
=DatePart("ww",Date())

That will return the records for the current week.

Paul
 
Assuming you're taking Sunday as the first day of the week, then you need a WHERE clause something like this in your query:
Code:
WHERE [NameOfYourDateFieldHere] BETWEEN (Date()-Weekday(Date(),1)) And (Date()+(7-Weekday(Date(),1))
Hope this helps.

[pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top