the iif function in a query

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

Guest

i have the following function:

Home Team Results: IIf([Home Team Score]>[Visiting Team Score],"Win","Loss")

However, There are games not played yet that have null values for the [home
team score] and [visiting team score] when I run the querry is shows a loss
for each record that hasn't had any scores added to it.

Question: how can I leave the home team results field blank if no score has
been added to the fields.

thanks.
 
First test for one of the score's being Null. Only if this is the case
compare the scores:

IIf(IsNull([Home Team Score]),"",IIf([Home Team Score]>[Visiting Team
Score],"Win","Loss"))

Ken Sheridan
Stafford, England
 
IIF(Nz([HomeTeamScore],"")="",[HomeTeamScore],IIF([HomeTeamScore]>[VisitingTeamScore],"Win","Loss"))

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Tried it and it works perfectly...

Thanks alot

Ken Sheridan said:
First test for one of the score's being Null. Only if this is the case
compare the scores:

IIf(IsNull([Home Team Score]),"",IIf([Home Team Score]>[Visiting Team
Score],"Win","Loss"))

Ken Sheridan
Stafford, England

BrianPaul said:
i have the following function:

Home Team Results: IIf([Home Team Score]>[Visiting Team Score],"Win","Loss")

However, There are games not played yet that have null values for the [home
team score] and [visiting team score] when I run the querry is shows a loss
for each record that hasn't had any scores added to it.

Question: how can I leave the home team results field blank if no score has
been added to the fields.

thanks.
 
Back
Top