Not printing field if not there

G

Guest

On printing an Access2003 doc: I am printing the customers address for
mailing. If they have a address2 (more then just a street name...address1 in
this case would be a suite name, etc) I want to print it, if not, I don't BUT
I don't want the blank line there. How would one do that?

=[FirstName] & " " & [LastName] & Chr(13) & Chr(10) & [Addr1] & Chr(13) &
Chr(10) & [Addr2] & ", " & [State] & " " & [Zip]...

Thanks so much ...in advance for your effort!
 
G

Guest

Hi Bill. I assume that the address2 line is on a line without a label?!
Set textbox property "can shrink" for the address2 to yes.
Than also set the property for the report band where this textbox is located
to cna shrink yes.
This should remove the blank line. If you now have an issue with improper
spacing etc, you may have to increase the vertical size of the textboxes to
force for the required spacing.
Hope this helps.
Fons
 
J

John Spencer (MVP)

If Addr2 is Null (and not a zero-length string), you can use the fact that the +
operator propagates nulls when you are combining strings, while the & operator
works as if the null was a zero length string. So given your example, you can
make the slight modification shown below. I didn't see city in your example


=[FirstName] & " " & [LastName]
& Chr(13) & Chr(10) & [Addr1]
& (Chr(13) + Chr(10) + [Addr2]) & Chr(13) & Chr(10)
& [City] &", " & [State] & " " & [Zip]

Of course that is really all on one line, but I broke it up for clarity.
 

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

Top