A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Date Range in Crosstab query



 
 
Thread Tools Display Modes
  #1  
Old July 19th, 2008, 06:53 PM posted to microsoft.public.access.queries
Jomark
external usenet poster
 
Posts: 32
Default Date Range in Crosstab query

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
  #2  
Old July 20th, 2008, 10:48 AM posted to microsoft.public.access.queries
Allen Browne
external usenet poster
 
Posts: 11,706
Default Date Range in Crosstab query

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
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Jomark" wrote in message
...
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


  #3  
Old July 21st, 2008, 07:01 PM posted to microsoft.public.access.queries
Jomark
external usenet poster
 
Posts: 32
Default Date Range in Crosstab query

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

"Allen Browne" wrote:

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
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Jomark" wrote in message
...
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



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:40 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.