Carriage Return in Form

G

Guest

Hi - I want to display the name and address of an individual in a
'non-editable] field so that it looks like a proper mailing address [with new
lines rather than all strung together]. I tried this expression in the text
control [from a previous post by another person] but it doesn't work ....

([CG1FirstName] & " " & [CG1LastName] & chr(13) & chr(10) & [CG1Address] &
chr(13) & chr(10) & [CG1District] & chr(13) & chr(10) [CG1City] & " " &
[CG1PostalCode])

What am I doing wrong?

TIA
 
F

fredg

Hi - I want to display the name and address of an individual in a
'non-editable] field so that it looks like a proper mailing address [with new
lines rather than all strung together]. I tried this expression in the text
control [from a previous post by another person] but it doesn't work ....

([CG1FirstName] & " " & [CG1LastName] & chr(13) & chr(10) & [CG1Address] &
chr(13) & chr(10) & [CG1District] & chr(13) & chr(10) [CG1City] & " " &
[CG1PostalCode])

What am I doing wrong?

TIA

"but it doesn't work" doesn't tell us anything?
Do you get an #error? a #Name? The program crashed? What?

The expression should work fine if you placed an = sign in front of
the expression, i.e. = [CG1Firstname] etc., the control name is not
the same as one of the fields in the expression, and you have not
misspelled one of the fields in the expression.
Note: You do not need the first and last parenthesis.
 
S

Steve Schapel

Sue,

Looks like the expression is missing a & between the last Chr(10) and
the [CG1City], and also you need a = in the beginning.

If this doesn't fix it, could you give an explanation of the term "it
doesn't work"?
 
G

Guest

Thanks Fred and Steve - I fixed up the expression so that it now reads ....
=[CG1FirstName] & " " & [CG1LastName] & chr (13) & chr(10) & [CG1Address] &
chr(13) & chr(10) & [CG1District] & chr(13) & chr(10) & "[CG1City] & " " &
[CG1PostalCode]

An error message now comes back with 'the expression you entered has an
invalid string .. a string can be up to 255 char long....' I checked all the
field controls and they only come up to 110 characters..

TIA
--
Sue Compelling


Steve Schapel said:
Sue,

Looks like the expression is missing a & between the last Chr(10) and
the [CG1City], and also you need a = in the beginning.

If this doesn't fix it, could you give an explanation of the term "it
doesn't work"?

--
Steve Schapel, Microsoft Access MVP

Sue said:
Hi - I want to display the name and address of an individual in a
'non-editable] field so that it looks like a proper mailing address [with new
lines rather than all strung together]. I tried this expression in the text
control [from a previous post by another person] but it doesn't work ....

([CG1FirstName] & " " & [CG1LastName] & chr(13) & chr(10) & [CG1Address] &
chr(13) & chr(10) & [CG1District] & chr(13) & chr(10) [CG1City] & " " &
[CG1PostalCode])

What am I doing wrong?

TIA
 
G

Guest

Hi Fred and Steve - I done it, I done it - I found a rogue " in the
expression. Thanks for your help - brilliant
 
F

fredg

Sue,

Looks like the expression is missing a & between the last Chr(10) and
the [CG1City], and also you need a = in the beginning.

If this doesn't fix it, could you give an explanation of the term "it
doesn't work"?

Good catch Steve. Your eyes were sharper than mine!
 

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