I am trying to create labels and I copied the code (from microsoft knowledge base) below into the controlsource of a textbox. This code concatenates fields to remove blank lines if a field is null. My fields are FIRSTNAME, SPOUSE, LASTNAME, ADDRESS, CITY, STATE, ZIP.
It works fine but when I have a spouse name included I want to add the ampersand(&) and I cannot figure out how to insert into the code. Can someone Help me out?
=IIf(IsNull([FirstName]),"",[FirstName] & " "
& _
IIf(IsNull([Spouse]),"",[Spouse] & Chr(13) & Chr
(10)) & _
IIf(IsNull([LastName]),"",[LastName]& Chr(13)& Chr(10)) & _
IIf(IsNull([ADDRESS]),"",[ADDRESS] & Chr(13) & Chr(10)) & _
IIf(IsNull([CITY]),"",[CITY] & ", "
& _
IIf(IsNull([PostalCode]),"",[PostalCode])
It works fine but when I have a spouse name included I want to add the ampersand(&) and I cannot figure out how to insert into the code. Can someone Help me out?
=IIf(IsNull([FirstName]),"",[FirstName] & " "
IIf(IsNull([Spouse]),"",[Spouse] & Chr(13) & Chr
(10)) & _
IIf(IsNull([LastName]),"",[LastName]& Chr(13)& Chr(10)) & _
IIf(IsNull([ADDRESS]),"",[ADDRESS] & Chr(13) & Chr(10)) & _
IIf(IsNull([CITY]),"",[CITY] & ", "
IIf(IsNull([PostalCode]),"",[PostalCode])