Parameter Query

  • Thread starter Thread starter Paul Scott
  • Start date Start date
P

Paul Scott

I've created a parameter query that gives me an age
range. But there are times when I'm wanting the query to
display everyone's age. The parameter I'm using is:

Between [Enter a start age] And [Enter an ending age]

What would I add to the parameter so it would display
everyone's age? Or, how would I do the parameter?

Thanks for the help,

Paul
 
Paul said:
I've created a parameter query that gives me an age
range. But there are times when I'm wanting the query to
display everyone's age. The parameter I'm using is:

Between [Enter a start age] And [Enter an ending age]

What would I add to the parameter so it would display
everyone's age? Or, how would I do the parameter?

Thanks for the help,

Paul
Paul,

WHERE YourTable.Age Between [Start] And [End]
OR YourTable.Age Like IIf(IsNull([Start]),"*")

Though you could just leave it alone and enter 0 and 150
in the Start and End prompts.
I suspect everyone will fit into that category. ;-)

I hope you are calculating the Age from the DateOfBirth field on the
fly, and not attempting to store Age in any table.
 
You could do this and it would leave both options open:

Under the Age field keep the criteria you have now

Add two calculated fields, example follows:

Expr1: [Enter a start age]
Expr2: [Enter an ending age]

The criteria for your fields should be as follows:
Age Field: Criteria Line 1: keep as Between [Enter a
start age] And [Enter an ending age]

Expr1: (on Criteria Line 2) IS NULL
Expr2: (on Criteria Line 2) IS NULL

This would allow you to either enter ages or not. If you
enter ages it will display that criteria, but if you enter
nothing it will display all.

While there's probably a better way, it works. Hope this
helps!
Loretta
 
What the heck, here is another method

Between NZ([Enter a Start Age],0)
and NZ([Enter an Ending Age],2000)

This will fail to find anyone that did not have an Age.

Loretta said:
You could do this and it would leave both options open:

Under the Age field keep the criteria you have now

Add two calculated fields, example follows:

Expr1: [Enter a start age]
Expr2: [Enter an ending age]

The criteria for your fields should be as follows:
Age Field: Criteria Line 1: keep as Between [Enter a
start age] And [Enter an ending age]

Expr1: (on Criteria Line 2) IS NULL
Expr2: (on Criteria Line 2) IS NULL

This would allow you to either enter ages or not. If you
enter ages it will display that criteria, but if you enter
nothing it will display all.

While there's probably a better way, it works. Hope this
helps!
Loretta
-----Original Message-----
I've created a parameter query that gives me an age
range. But there are times when I'm wanting the query to
display everyone's age. The parameter I'm using is:

Between [Enter a start age] And [Enter an ending age]

What would I add to the parameter so it would display
everyone's age? Or, how would I do the parameter?

Thanks for the help,

Paul
.
 
Back
Top