Suppressing the # in a string if there's no data

  • Thread starter Thread starter FredK
  • Start date Start date
F

FredK

I'm using Access 2003 and I'm trying to print an address on a letter. I
have a data field named "mailing_address_apt". When there's data in the
field, I'd like to have the "#" print in front of the data. And when there
is no data in the field, I don't want the "#" to print.

I'm using the below string, but it always prints the "#" whether there's
data or not.

=[mailing_address_street_name] & " #" & [mailing_address_apt]



Any help would be appreicated.
 
IIF(IsNull(mailing_address_apt), [mailing_address_street_name],
[mailing_address_street_name] & " #" & [mailing_address_apt])
 
I'm using Access 2003 and I'm trying to print an address on a letter. I
have a data field named "mailing_address_apt". When there's data in the
field, I'd like to have the "#" print in front of the data. And when there
is no data in the field, I don't want the "#" to print.

I'm using the below string, but it always prints the "#" whether there's
data or not.

=[mailing_address_street_name] & " #" & [mailing_address_apt]

Any help would be appreicated.

you can take advantage of the fact that "#" + Null = Null

=[mailing_address_street_name] & (" #" + [mailing_address_apt])
 
Back
Top