How to set parameter for part of a date range

E

Elwood

Here's what we currently have - a query that looks for information in
a certain month of a range of years. So, for example:

#>8/31/2005# AND <#10/1/2005#
#>8/31/2004# AND <#10/1/2004#
#>8/31/2003# AND <#10/1/2003#
#>8/31/2002# AND <#10/1/2002#
#>8/31/2001# AND <#10/1/2001#

Each of these is currently on a separate line in the QBE grid. Finds
us all of September's records for the 5 years listed.

I'd like to set this up as a parameter somehow so it would pause and
ask the user:

1) The month they are interested in
2) The range of years to search

What would be the best way to do this?

Thanks for any help!

E
 
M

Michel Walsh

Hi,


.... WHERE Month( myDateTimeField ) = 9


is a criteria independent of the year.



.... WHERE Month( MyDateTimeField ) = 9 AND Year( MyDateTimeField) >
Year(now()) - 5



will limit to the month of September, for the last five year (including this
year, even if September is not in the "past", at this actual year).



Hoping it may help,
Vanderghast, Access MVP
 
E

Elwood

Thanks, I'll give it a try,

C

Hi,


... WHERE Month( myDateTimeField ) = 9


is a criteria independent of the year.



... WHERE Month( MyDateTimeField ) = 9 AND Year( MyDateTimeField) >
Year(now()) - 5



will limit to the month of September, for the last five year (including this
year, even if September is not in the "past", at this actual year).



Hoping it may help,
Vanderghast, Access MVP
 

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