carriage return in query

CData
3StarLounger
Posts: 308
Joined: 24 Dec 2015, 16:41

carriage return in query

Post by CData »

in a form's text box one can do a shift/return and control the line breaks - and so I know that the carriage return is storable in the table's record.

but am wrestling with how to accomplish the same thing via an Update query. To keep the existing text, and add to it - the Update To field of the query design is:
[Comment] & " " & [newComment]

and this works fine....but if/when the user's do this manually via the form they do the shift enter to put new comments on a new line (is a memo field type) and so I would like to accomplish that via the query as well....

my attempts so far to put in vbCrLf gets wrapped in quotes and ends up as text...

User avatar
HansV
Administrator
Posts: 78620
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: carriage return in query

Post by HansV »

vbCrLf is a VBA constant, you cannot use it in a query. Use the following instead:

[Comment] & Chr(13) & Chr(10) & [newComment]
Best wishes,
Hans

CData
3StarLounger
Posts: 308
Joined: 24 Dec 2015, 16:41

Re: carriage return in query

Post by CData »

worked like a champ.....thanks.