Need help with IIf

S

Sandy

Hello -

I want to say if the value is 1, write "Home", if it's 2, write "Business",
if it's 3, write "Both.

Any help will be greatly appreciated!
 
S

Sandy

Hello Newbie -

Thanks for your response. Your answer is exactly what I tried before
posting. I get "#Error" on my report from this.

It's got to be something stupid . . .
--
Sandy


Newbie said:
=iif([yourfield] = 1, "Home", iif([yourfield] = 2, "Business", "Both"))

HTH
Ali
Sandy said:
Hello -

I want to say if the value is 1, write "Home", if it's 2, write
"Business",
if it's 3, write "Both.

Any help will be greatly appreciated!
 
B

BruceM

Is [yourfield] a number field? If it is a text or memo field you will need
to put the values inside double quotes in your IIf statement. Where are you
putting this IIf statement? It should work as the control source of a text
box, or as a calculated field in a query.

Sandy said:
Hello Newbie -

Thanks for your response. Your answer is exactly what I tried before
posting. I get "#Error" on my report from this.

It's got to be something stupid . . .
--
Sandy


Newbie said:
=iif([yourfield] = 1, "Home", iif([yourfield] = 2, "Business", "Both"))

HTH
Ali
Sandy said:
Hello -

I want to say if the value is 1, write "Home", if it's 2, write
"Business",
if it's 3, write "Both.

Any help will be greatly appreciated!
 
M

Marshall Barton

Sandy said:
Thanks for your response. Your answer is exactly what I tried before
posting. I get "#Error" on my report from this.


The usual reason for that error is that the text box is
named the same as the field in the expression.
 
S

Sandy

Hi Bruce -

Thanks for your reply. I'm putting it in as a control source for a textbox.
I did try it both with and without the quotes - neither worked (although it
should have the quotes because it is a text field). Could something be
corrupted?

--
Sandy


BruceM said:
Is [yourfield] a number field? If it is a text or memo field you will need
to put the values inside double quotes in your IIf statement. Where are you
putting this IIf statement? It should work as the control source of a text
box, or as a calculated field in a query.

Sandy said:
Hello Newbie -

Thanks for your response. Your answer is exactly what I tried before
posting. I get "#Error" on my report from this.

It's got to be something stupid . . .
--
Sandy


Newbie said:
=iif([yourfield] = 1, "Home", iif([yourfield] = 2, "Business", "Both"))

HTH
Ali
Hello -

I want to say if the value is 1, write "Home", if it's 2, write
"Business",
if it's 3, write "Both.

Any help will be greatly appreciated!
 
Top