Problem with IIf

  • Thread starter Thread starter Russell Pascoe
  • Start date Start date
R

Russell Pascoe

Hi!

I am pretty familiar with using IIf, but am having problems...

I have a table that has "Work Number" storing telephone numbers as Text

In my report I am using IIf ( [Work Number]] Is Null, "Missing", [Work
Number])

So, if the field is blank, I hope to see "Missing" in the report, and if it
is not empty, I hope to see the work number displayed. For some reason this
is producing #Error in every instance in the report, and I am at a complete
loss to explain why!

Can anyone spot my mistake?

Thanks!
 
Hi!

I am pretty familiar with using IIf, but am having problems...

I have a table that has "Work Number" storing telephone numbers as Text

In my report I am using IIf ( [Work Number]] Is Null, "Missing", [Work
Number])

So, if the field is blank, I hope to see "Missing" in the report, and if it
is not empty, I hope to see the work number displayed. For some reason this
is producing #Error in every instance in the report, and I am at a complete
loss to explain why!

Can anyone spot my mistake?

Thanks!

1) Make sure the name of this control is NOT "Work Number".
 
Russell said:
Hi!

I am pretty familiar with using IIf, but am having problems...

I have a table that has "Work Number" storing telephone numbers as
Text

In my report I am using IIf ( [Work Number]] Is Null, "Missing", [Work
Number])

So, if the field is blank, I hope to see "Missing" in the report, and
if it is not empty, I hope to see the work number displayed. For some
reason this is producing #Error in every instance in the report, and
I am at a complete loss to explain why!

Can anyone spot my mistake?

Thanks!

Perhaps just a typo in your post but you have an extra ] in the above...

IIf ( [Work Number]] Is Null, "Missing", [Work Number])
^

You do also have an "=" in front of the expression yes?
 
It was the name of the Control - Thank you Fred.

Rick, it was "just" a typo, but thanks for your attention!

fredg said:
Hi!

I am pretty familiar with using IIf, but am having problems...

I have a table that has "Work Number" storing telephone numbers as Text

In my report I am using IIf ( [Work Number]] Is Null, "Missing", [Work
Number])

So, if the field is blank, I hope to see "Missing" in the report, and if it
is not empty, I hope to see the work number displayed. For some reason this
is producing #Error in every instance in the report, and I am at a complete
loss to explain why!

Can anyone spot my mistake?

Thanks!

1) Make sure the name of this control is NOT "Work Number".
 
Try
=IIf(IsNull([Work Number]), "Missing", [Work Number])

Also make sure that the control you are using this in is not named 'Work
Number'.
 
Back
Top