Multiple Year parameter

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a query that allows the user to select data by year Between
DateSerial([Enter Year:],1,1) And DateSerial([Enter Year:]+1,1,0) This works
great, however I would like them to be able to compare 2 years on a report so
I would like it to ask them [Enter Year1:] or [Enter Year2:] The Year 2 would
be optional so if they put nothing it would just display Year1 detail.

I was alos wondering how I could modify the above code so they could put 1
and it would display January detail, 2 Februrary detail etc......

Thanks for the help!!
 
Parameters are not flexible enough to do what you need. There are some
horrible workarounds, but they are very inefficient.

The simplest solution is to provide a form where the user can enter the date
range they want to cover. You can then supply all values if they enter no
dates, all values onwards if they just enter the first, all values up to the
second one if they just enter the 2nd, or all values between the dates if
they enter both.

There is an example of how to do that in the 2nd part of this article:
Limiting a Report to a Date Range
at:
http://allenbrowne.com/casu-08.html
You can do exactly the same thing as a Filter for a form, or to build the
SQL statement directly in code.
 

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

Back
Top