IFF and AND

  • Thread starter Thread starter Derek
  • Start date Start date
D

Derek

Can someone please look at the following coding and tell me what is wrong
with it. It thinks that "$12.00" and "$15.00" are values that require input.
I just want to display those 2 values if the statement is right or wrong.

Before Jan 1:
IIf([tblanimals]![servicedog]=Yes,"$0.00",IIf([tblanimals]![altered]=Yes And
[tblowners]![Senior]=Yes,â€$12.00",$15.00â€))
 
Derek said:
Can someone please look at the following coding and tell me what is wrong
with it. It thinks that "$12.00" and "$15.00" are values that require input.
I just want to display those 2 values if the statement is right or wrong.

Before Jan 1:
IIf([tblanimals]![servicedog]=Yes,"$0.00",IIf([tblanimals]![altered]=Yes And
[tblowners]![Senior]=Yes,â€$12.00","$15.00â€))
 
In the post above, I am missing a " before "$15.00". In the database that "
is not missing.
 
I can't tell for sure, but your posting has †as delimiters instead of " as
the delimiter.

IIf([tblanimals]![servicedog]=Yes,"$0.00",IIf([tblanimals]![altered]=Yes And
[tblowners]![Senior]=Yes,"$12.00","$15.00"))

That should work, but you might try the following. I am assuming that the
three fields mentioned are yes/no (boolean) fields.

IIf([tblanimals]![servicedog]=-1,"$0.00",IIf([tblanimals]![altered]=-1 And
[tblowners]![Senior]=-1,"$12.00","$15.00"))

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
In the post above, I am missing a " before "$15.00". In the database that "
is not missing.

Derek said:
Can someone please look at the following coding and tell me what is wrong
with it. It thinks that "$12.00" and "$15.00" are values that require input.
I just want to display those 2 values if the statement is right or wrong.

Before Jan 1:
IIf([tblanimals]![servicedog]=Yes,"$0.00",IIf([tblanimals]![altered]=Yes And
[tblowners]![Senior]=Yes,â€$12.00",$15.00â€))
 
Are you sure you want to return a string/text value from this expression?

I would also probably create either a lookup table that stores the value of
0, 12, and 15 or create a small user-defined function to perform the
calculation. Creating expressions like this in a query could become a
nightmare when your fees change. IMHO, hard-coded values don't belong in
expressions like this.
--
Duane Hookom
Microsoft Access MVP


John Spencer said:
I can't tell for sure, but your posting has †as delimiters instead of " as
the delimiter.

IIf([tblanimals]![servicedog]=Yes,"$0.00",IIf([tblanimals]![altered]=Yes And
[tblowners]![Senior]=Yes,"$12.00","$15.00"))

That should work, but you might try the following. I am assuming that the
three fields mentioned are yes/no (boolean) fields.

IIf([tblanimals]![servicedog]=-1,"$0.00",IIf([tblanimals]![altered]=-1 And
[tblowners]![Senior]=-1,"$12.00","$15.00"))

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
In the post above, I am missing a " before "$15.00". In the database that "
is not missing.

Derek said:
Can someone please look at the following coding and tell me what is wrong
with it. It thinks that "$12.00" and "$15.00" are values that require input.
I just want to display those 2 values if the statement is right or wrong.

Before Jan 1:
IIf([tblanimals]![servicedog]=Yes,"$0.00",IIf([tblanimals]![altered]=Yes And
[tblowners]![Senior]=Yes,â€$12.00",$15.00â€))
 
Back
Top