Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Blank fields on labels

Status
Not open for further replies.

liltechy

Programmer
May 17, 2002
145
US
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])
 
try changing

IIf(IsNull([Spouse]),"",[Spouse] & Chr(13) & Chr
(10)) & _

to
IIf(IsNull([Spouse]),"", " " & chr(38) & " " & [Spouse] & Chr(13) & Chr
(10)) & _


BTW.. you can replace Chr(13) & Chr(10) with vbCrLf if you'd like

PaulF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top