austinmoran
MIS
I have created a fairly simple report in Access 2007 in which I include FirstName, MiddleName, LastName, OfficeAddress1, OfficeAddress2, OfficeCity, OfficeState, OfficeZip. It works fine if I create a separate text box for each line, with one exception. If there is no data, for example, in the OFFICEADDRESS2 field, then it obviously leaves a blank line and looks pretty cheesy. I have attempted to create a single text box and add the following code to the Control Source but I get an error. I had hoped that it would remove the blank line when a field is empty:
The error that comes up in the DESIGN view when I attempt to exit the text box is: The Expression you entered contains invalid syntax...etc, etc, etc
What am I doing wrong?
Thanks in advance for any/all assistance you might be able to offer.
-Austin
Code:
=IIf(IsNull([OFFICEADDRESS1]),"",[OFFICEADDRESS1] & Chr(13) & Chr(10)) & _
IIf(IsNull([OFFICEADDRESS2]),"",[OFFICEADDRESS2] & Chr(13) & Chr(10)) & _
IIf(IsNull([OFFICECITY]),"",[OFFICECITY] & ", ") & _
IIf(IsNull([OFFICESTATE]) ,"",[OFFICESTATE] & " ") & _
IIf(IsNull([OFFICEZIP]),"",[OFFICEZIP])
What am I doing wrong?
Thanks in advance for any/all assistance you might be able to offer.
-Austin