best way to show my address

R

rodchar

hey all,
i would like to display my customer address on my form as read only. what's
the best way to do this. idealy i'd like to display the address as one big
field inside a label or textbox that way it can easily be selected and copied
to clipboard. Plus the address consists of a street address line 1 field and
line 2 field in the table and if possible i'd like to omit line 2 if it's
blank so that gap won't show up?

any ideas?
thanks,
rodchar
 
J

John W. Vinson

hey all,
i would like to display my customer address on my form as read only. what's
the best way to do this. idealy i'd like to display the address as one big
field inside a label or textbox that way it can easily be selected and copied
to clipboard. Plus the address consists of a street address line 1 field and
line 2 field in the table and if possible i'd like to omit line 2 if it's
blank so that gap won't show up?

any ideas?
thanks,
rodchar

Simply set the Enabled property of the textbox to No, and its Locked property
to Yes. The user won't be able to change anything in it. Actually if you base
it on a concatenated expression as stated below, you need not do so, as a
calculated field cannot be edited.

To display the address with null lines omitted, you can use the facts that
Chr(13) & Chr(10) corresponds to a new line; and that the + and & operators
both concatenate strings, but & treats NULL as a zero length string, whereas +
"propagates nulls", returning NULL if either argument is NULL. So:

[Address1] & Chr(13) & Chr(10) & ([Address2] + Chr(13) + Chr(10)) & [City] & "
" & [StateProvince] & " " & [Postcode]

will show either

123 Main St.
Suite 36
Podunk NC 12345

or

335 Queen St
Toronto ON Z1X A3Z

as appropriate.

John W. Vinson [MVP]
 
R

rodchar

thanks a whole lot for the help.
rod.

John W. Vinson said:
hey all,
i would like to display my customer address on my form as read only. what's
the best way to do this. idealy i'd like to display the address as one big
field inside a label or textbox that way it can easily be selected and copied
to clipboard. Plus the address consists of a street address line 1 field and
line 2 field in the table and if possible i'd like to omit line 2 if it's
blank so that gap won't show up?

any ideas?
thanks,
rodchar

Simply set the Enabled property of the textbox to No, and its Locked property
to Yes. The user won't be able to change anything in it. Actually if you base
it on a concatenated expression as stated below, you need not do so, as a
calculated field cannot be edited.

To display the address with null lines omitted, you can use the facts that
Chr(13) & Chr(10) corresponds to a new line; and that the + and & operators
both concatenate strings, but & treats NULL as a zero length string, whereas +
"propagates nulls", returning NULL if either argument is NULL. So:

[Address1] & Chr(13) & Chr(10) & ([Address2] + Chr(13) + Chr(10)) & [City] & "
" & [StateProvince] & " " & [Postcode]

will show either

123 Main St.
Suite 36
Podunk NC 12345

or

335 Queen St
Toronto ON Z1X A3Z

as appropriate.

John W. Vinson [MVP]
 

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