The Student Room Group

MS Access

Renting Status: IIf([Rent]="Yes","Renting", [Rent]="No","Purchased")

Does anyone know what word could be used to link these? Thanks
Original post by aceline12
Renting Status: IIf([Rent]="Yes","Renting", [Rent]="No","Purchased")

Does anyone know what word could be used to link these? Thanks

To what does the word "these" refer? Are you trying to link the two conditions? The two values for Renting Status? Or do you can two separate IIf expressions which you're trying to combine?

Can you write the sentence you want to use, but with XXX for the word that you're struggling to find? That would help us work out what you mean.
Original post by aceline12
Renting Status: IIf([Rent]="Yes","Renting", [Rent]="No","Purchased")

Does anyone know what word could be used to link these? Thanks

Actually, I think I've just twigged what you mean. What values can [Rent] have? If it can only have the values "Yes" or "No" then you want:

IIf([Rent]="Yes","Renting","Purchased")

If [Rent] is "Yes" then the result will be "Renting"; otherwise it will be "Purchased". (This only works if the 'otherwise' branch can only mean "No".)

If [Rent] can have values other than "Yes" or "No" then you'll need to test two nested IIf statements:

IIf([Rent]="Yes","Renting",IIf([Rent]="No","Purchased","Unknown"))

Does that make sense?

Quick Reply