Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / May 2005

Tip: Looking for answers? Try searching our database.

Multiple Year parameter

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Branden - 20 May 2005 19:17 GMT
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!!
Allen Browne - 21 May 2005 04:44 GMT
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.

Signature

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.

>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
[quoted text clipped - 9 lines]
>
> Thanks for the help!!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.