Weekly Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
I have a table with following;

Date
Time
BSL
Insulin
Amount

What I would like to do is is create a query that allows me to group by the
week.
Then I would like to base a chart on this query to allow me to track the BSL

How do I create a query that can group on a week??
 
You need to use the DatePart function in the WHERE clause
to extract the week of the year. Specifically:

SELECT *
FROM TableName
WHERE DatePart("ww", [Date]) = DesiredValue

Just as an aside, it usually isn't a good idea to have
field names that are the same as keywords like Date and
Time. It can lead to some confusion later.

MB
 
Date and Time are reserved words and you should not use them as field names.
Eventually you will have trouble because Access will not know if you mean
the fields or if you mean the Date and Time functions.

Put the following in a blank field in your query:
DataYear:Year([MyDate])
Sort Ascending

Put the following in a blank field to the right of DateYear in your query:
DateWeek:DatePart("ww",[MyDate])
Sort Ascending
 
Back
Top