IIF in label report

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

Guest

In printing labels, I have three phone numbers (Home, Office, & Cell and I am
trying to print a label in front of each one if there are data present. So I
go to my label in design mode and on the line for Phone, I keyed in:
=IIF([Phone] is null, "", "PHONE: " [Phone]). I get an invalid syntax -
operand w/o an operator. It appears to me I can't use the IIF within a
label? I would appreciate any help you may give me. Thanks, Tom
 
In printing labels, I have three phone numbers (Home, Office, & Cell and I am
trying to print a label in front of each one if there are data present. So I
go to my label in design mode and on the line for Phone, I keyed in:
=IIF([Phone] is null, "", "PHONE: " [Phone]). I get an invalid syntax -
operand w/o an operator. It appears to me I can't use the IIF within a
label? I would appreciate any help you may give me. Thanks, Tom

A simpler option involves no IIF at all, and uses the fact that both
the & and + operators concatenate strings, but the + operator returns
NULL if either string is NULL:

= "PHONE: " + [Phone]


John W. Vinson[MVP]
 
Perfect!! Thanks to both of you for solving my problem.

John Vinson said:
In printing labels, I have three phone numbers (Home, Office, & Cell and I am
trying to print a label in front of each one if there are data present. So I
go to my label in design mode and on the line for Phone, I keyed in:
=IIF([Phone] is null, "", "PHONE: " [Phone]). I get an invalid syntax -
operand w/o an operator. It appears to me I can't use the IIF within a
label? I would appreciate any help you may give me. Thanks, Tom

A simpler option involves no IIF at all, and uses the fact that both
the & and + operators concatenate strings, but the + operator returns
NULL if either string is NULL:

= "PHONE: " + [Phone]


John W. Vinson[MVP]
 

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

Back
Top