Problem with IIf

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!
 
F

fredg

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".
 
R

Rick Brandt

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?
 
R

Russell Pascoe

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".
 
A

AG

Try
=IIf(IsNull([Work Number]), "Missing", [Work Number])

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Help with Iif on Report 4
Switch Function w/nested IIf Functions 1
IIf statement 9
Removing Empty Line 5
Problems with AND in multiple IIF statements 5
Multiple IIf 3
IIf - Sum Problem 1
complicated IIF 3

Top