|
Question : Selecting and Viewing Range of Dates by Month in Access Query
|
|
Hi,
I creating a database to analyse surveys for a small hospital, and am trying to create a query that allows one to analyse surveys, by month, between a selected range of months (i.e. between July 2002 and June 2003)
The Date that each survey was conducted was saved in the field [Survey Date]
My query runs fine, if I view ALL survey responses by month, set up as follows:
[Survey Year] [Survey Month Number] [Survey Month Survey Year] Year(Survey Date) Month(Survey Date) Format(Survey Date, "mmmm yyyy")
(All surveys are grouped, by month, in order--and the query results are fed directly into a report)
Each of these has the Total selected as "Group By"
However, I'm not sure how to SELECT the months that I would like to analyse.
I have tried to create the following criterion under [Survey Month Survey Year]:
Between [Enter first month (Example: January 2002)] And [Enter last month (Example: January 2002)]
This produces quite erratic results (not in order of month and year, and seemingly selects random months!).
Any ideas on solving this problem would be most appreciated!!
Thanks,
Tony
|
|
Answer : Selecting and Viewing Range of Dates by Month in Access Query
|
|
OK, try for the Between:
Between DateSerial(year("01 " & [Enter first month (Example: January 2002)]),Month("01 " & [Enter first month (Example: January 2002)]),"01") And DateSerial(Year("01 " & [Enter last month (Example: February 2002 02)]),Month("01 " & [Enter last month (Example: February 2002 02)] )+1,"00")));
Nic;o)
|
|
|
|