You could use a concatenated calculated field
Assumption:
Address_Line1 always has a value
All address lines are null if they are blank (no zero length strings)
One Method to do that is as follows
Field: FullAddress: Address_Line1 & Chr(13) & Chr(10) &
IIF(Address_Line2 is Null,Null,Address_line2 & Chr(13) & Chr(10)) &
IIF(Address_Line3 is Null,Null,Address_line3 & Chr(13) & Chr(10)) &
IIF(Address_Line4 is Null,Null,Address_line4 & Chr(13) & Chr(10)) &
[Post/zip Code]
You can also take advantage of the different way Access handles concatenation
using + and &. The "&" operator treats nulls as if they were zero-length
strings so it doesn't propagate the null. The "+" operator treats nulls as
nulls and Null plus anything is Null.
Address_Line1 & Chr(13) & Chr(10) &
(Address_line2 + Chr(13) + Chr(10)) &
(Address_line3 + Chr(13) + Chr(10)) &
(Address_line4 + Chr(13) + Chr(10)) &
[Post/zip Code]
If you want Post/Zip Code on the same line as the last Address line you will
need to adjust the formula. You can do that by moving the Chr(13) + Chr(10) to
the beginning of each address line string and removing the Chr(13) Chr(10)
combination from the first address line.
By the way all the above are on one line in the query, but for clarity I put
each line of data onto a separate line.
Paul said:
I have a query from which an invoice is printed. How do I eliminate
blank address lines?
For example if I have address_line1, address_line2,
address_line3,address_line4, post/zip code and there is data only in
address_lines 1 and 2 and post/zip/code,how do I eliminate the two blank
lines when printing the invoice?
Thanks