Code to add a carriage return to a memo field in a form

I

Ihar

Hi

I have a form, with multiple fields which then get concatenated to a single
memo field on the form.

The output I am after is that the information that gets added will have a
blank line after it and the then the rest of the information that is already
in the destination field

I can do the concatenation ok, but I am unable to insert the carriage return
at the end of the string. I have tried the code below and it does not work,
any suggestion would be most welcome

Me!Description = Me![Date] & " By: " & Me![By] & ", For: " & Me!For & ", - "
& Me!NewDescription & Chr(10) & Chr(10) & Me!Description

While this codes adds the string perfectly, it does not add the required
carriage returns. I have tried with codes 10 (Line Feed) and 13 (carriage
return) but to no avail

I am using Access 2007.

Thanks in advance
 
I

Ihar

Thanks, works like a dream

Maurice said:
try vbCrLf instead of Chr(10) or Chr(13) see if that helps..

hth
--
Maurice Ausum


Ihar said:
Hi

I have a form, with multiple fields which then get concatenated to a
single
memo field on the form.

The output I am after is that the information that gets added will have a
blank line after it and the then the rest of the information that is
already
in the destination field

I can do the concatenation ok, but I am unable to insert the carriage
return
at the end of the string. I have tried the code below and it does not
work,
any suggestion would be most welcome

Me!Description = Me![Date] & " By: " & Me![By] & ", For: " & Me!For &
", - "
& Me!NewDescription & Chr(10) & Chr(10) & Me!Description

While this codes adds the string perfectly, it does not add the required
carriage returns. I have tried with codes 10 (Line Feed) and 13
(carriage
return) but to no avail

I am using Access 2007.

Thanks in advance
 
D

Douglas J. Steele

Just for the record, if you're not using the intrinsic constant vbCrLf, you
must use Chr(13) & Chr(10) in that order. (Chr(13) is a carriage return,
Chr(10) is a line feed)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ihar said:
Thanks, works like a dream

Maurice said:
try vbCrLf instead of Chr(10) or Chr(13) see if that helps..

hth
--
Maurice Ausum


Ihar said:
Hi

I have a form, with multiple fields which then get concatenated to a
single
memo field on the form.

The output I am after is that the information that gets added will have
a
blank line after it and the then the rest of the information that is
already
in the destination field

I can do the concatenation ok, but I am unable to insert the carriage
return
at the end of the string. I have tried the code below and it does not
work,
any suggestion would be most welcome

Me!Description = Me![Date] & " By: " & Me![By] & ", For: " & Me!For &
", - "
& Me!NewDescription & Chr(10) & Chr(10) & Me!Description

While this codes adds the string perfectly, it does not add the required
carriage returns. I have tried with codes 10 (Line Feed) and 13
(carriage
return) but to no avail

I am using Access 2007.

Thanks in advance
 

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