IIF in Parameter Query

MikeG

Registered User.
Local time
Today, 16:47
Joined
Oct 1, 2001
Messages
31
Is there a way to setup a parameter query so that if a user requests a specific year he/she would get that year's entries or if they type in ALL, they get all entries?
I've toyed with an IIF statement but haven't had much luck. I thought about setting it up as a BETWEEN/AND parameter query but wondered if there was something else available.
 
There are several ways you can do that.
In your query where your date is you can put "Like [Enter Date:]" If the user puts in just a "*" they will get all of the dates and if they put in "3/*/*" they will get all the years in March.

You can also do this "Between [Enter begining date:] And [Enter Ending Date:]" this way they put in the whatever range they want
smile.gif


Sohaila
 
Add a column to your query and set the field to something like this:

ByYear: Year([YourDateField])

In the criteria put these two lines one below the other:

[Forms]![YourForm]![YearField]
[Forms]![YourForm]![YearField]Is Null

Create a form and put an unbound field in it for the user to enter the date. Now they can enter a date in the field, click a command button and see the results. If they leave the field blank they will see all the records.
 

Users who are viewing this thread

Back
Top Bottom