Addresses with blank lines due to Null records

  • Thread starter Richard Allan Kelley
  • Start date
R

Richard Allan Kelley

I have the following information in a textbox:

=[ShippingName] & Chr(13) & Chr(10) & [shippingaddress1] &
Chr(13) & Chr(10) & [shippingaddress2] & Chr(13) & Chr(10)
& [ShippingCity] & ", " & [ShippingState] & " " &
[ShippingZip] & Chr(13) & Chr(10) & [Shippingmark] & Chr
(13) & Chr(10) & [Shippingmark2] & Chr(13) & Chr(10) &
[Shippingmark3] & Chr(13) & Chr(10) & [Shippingmark4] & Chr
(13) & Chr(10) & [shippingattn]

I had the Textbox set to Shrink/Grow as suggested in other
postings. It did not work. The Null fields were blank
coming up as blank fields.

Any suggestions on removing the Null fields in VB code or
a very long expression?

Richard
 
M

Marshall Barton

Richard said:
I have the following information in a textbox:

=[ShippingName] & Chr(13) & Chr(10) & [shippingaddress1] &
Chr(13) & Chr(10) & [shippingaddress2] & Chr(13) & Chr(10)
& [ShippingCity] & ", " & [ShippingState] & " " &
[ShippingZip] & Chr(13) & Chr(10) & [Shippingmark] & Chr
(13) & Chr(10) & [Shippingmark2] & Chr(13) & Chr(10) &
[Shippingmark3] & Chr(13) & Chr(10) & [Shippingmark4] & Chr
(13) & Chr(10) & [shippingattn]

I had the Textbox set to Shrink/Grow as suggested in other
postings. It did not work. The Null fields were blank
coming up as blank fields.

Any suggestions on removing the Null fields in VB code or
a very long expression?

There is a "trick" when concatenating values that might be
Null. The + operator will concatenate two strings, but if
one of them is Null, it will have a result of Null.
Translating that cryptic explanation to your expression
would be something like:

=[ShippingName] & (Chr(13) + Chr(10) + [shippingaddress1]) &
(Chr(13) + Chr(10) + [shippingaddress2]) & Chr(13) & Chr(10)
& [ShippingCity] & ", " & [ShippingState] & " " &
[ShippingZip] & (Chr(13) + Chr(10) + [Shippingmark]) &
(Chr(13) + Chr(10) + [Shippingmark2]) & (Chr(13) + Chr(10) +
[Shippingmark3]) & (Chr(13) + Chr(10) + [Shippingmark4]) &
(Chr(13) + Chr(10) + [shippingattn])
 

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