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
 

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

Similar Threads

SUM in a UNION query 2
Display columns without data in cross tab query 4
report on a cross tab query 1
crosstab query? 12
Sum query 5
Monthly quantities to Weekly 1
Need Sum of Weeks Between 2 Dates 1
Week Numbers 1

Back
Top