avoiding parameter queries

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

Guest

How does one avoid parameter queries? For example, I have a query with two
date fields, and a calculated field [FinalDate]that uses an IIf to determine
which of the two date fields is more recent and to set FinalDate to that
value. The query works fine. Then when I specify a date criterion for
FinalDate, msaccess always pops up a parameter box that asks for the value of
FinalDate. The FinalDate field obviously has a value, and the criterion
specifys a year with Year([FinalDate]) = 1999, so what needs to be done to
prevent the parameter box from opening?

Thanks,
LAF
 
LAF said:
How does one avoid parameter queries? For example, I have a query
with two date fields, and a calculated field [FinalDate]that uses an
IIf to determine which of the two date fields is more recent and to
set FinalDate to that value. The query works fine. Then when I
specify a date criterion for FinalDate, msaccess always pops up a
parameter box that asks for the value of FinalDate. The FinalDate
field obviously has a value, and the criterion specifys a year with
Year([FinalDate]) = 1999, so what needs to be done to prevent the
parameter box from opening?

Thanks,
LAF

[FinalDate] is not a real field. It is an alias and you cannot refer to an
alias in the same query. You have to repeat the expression that is used by
the alias.

Instead of...

Year([FinalDate]) = 1999

....you have to use...

Year(Whatever If() expression is used in [FinalDate]) = 1999
 
Thanks, Rick. I was unable to find this in access help, or even in books on
access.

LAF

Rick Brandt said:
LAF said:
How does one avoid parameter queries? For example, I have a query
with two date fields, and a calculated field [FinalDate]that uses an
IIf to determine which of the two date fields is more recent and to
set FinalDate to that value. The query works fine. Then when I
specify a date criterion for FinalDate, msaccess always pops up a
parameter box that asks for the value of FinalDate. The FinalDate
field obviously has a value, and the criterion specifys a year with
Year([FinalDate]) = 1999, so what needs to be done to prevent the
parameter box from opening?

Thanks,
LAF

[FinalDate] is not a real field. It is an alias and you cannot refer to an
alias in the same query. You have to repeat the expression that is used by
the alias.

Instead of...

Year([FinalDate]) = 1999

....you have to use...

Year(Whatever If() expression is used in [FinalDate]) = 1999
 

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