Date Range in Crosstab query

J

Jomark

I have a crosstab query using a date range Between #1/4/08# AND #31/3/09#
that works fine for this period.

What I would like to know is if it is possible to specify the year in
general terms with a parameter in order to be able to change the year rather
than having to physically change the date range in the query for the next
annual period of for example 1/4/09 and 31/3/10
 
A

Allen Browne

Try an expression like this in the Criteria under your date/time field:
= DateSerial([StartYear],4,1) And < DateSerial([StartYear]+1,4,1)

You will also need to declare this parameter as a number.
Choose Parameters on the Query menu.
In the dialog, enter:
StartYear Integer
 
J

Jomark

Thanks very much. It works just as I wanted.
The help is much appreciated.

Allen Browne said:
Try an expression like this in the Criteria under your date/time field:
= DateSerial([StartYear],4,1) And < DateSerial([StartYear]+1,4,1)

You will also need to declare this parameter as a number.
Choose Parameters on the Query menu.
In the dialog, enter:
StartYear Integer

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Jomark said:
I have a crosstab query using a date range Between #1/4/08# AND #31/3/09#
that works fine for this period.

What I would like to know is if it is possible to specify the year in
general terms with a parameter in order to be able to change the year
rather
than having to physically change the date range in the query for the next
annual period of for example 1/4/09 and 31/3/10
 

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