A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

adding a Carriage Return or Line Feed character to an update query



 
 
Thread Tools Display Modes
  #1  
Old May 25th, 2010, 12:50 AM posted to microsoft.public.access.queries
Paul
external usenet poster
 
Posts: 126
Default adding a Carriage Return or Line Feed character to an update query

I'm building an update query that will concatenate two fields and update the
first field with the combination of the two fields. However, I would like
to separate the two components with a blank line, or two carriage return or
line feed characters. In Visual Basic, I'd use vbcr&vbcr to do this. How
can I do this in an update query?

Thanks in advance,

Paul


  #2  
Old May 25th, 2010, 02:09 AM posted to microsoft.public.access.queries
Marshall Barton
external usenet poster
 
Posts: 5,361
Default adding a Carriage Return or Line Feed character to an update query

Paul wrote:

I'm building an update query that will concatenate two fields and update the
first field with the combination of the two fields. However, I would like
to separate the two components with a blank line, or two carriage return or
line feed characters. In Visual Basic, I'd use vbcr&vbcr to do this. How
can I do this in an update query?



In Access you should use vbCrLf, vbNewLine or Chr(13) &
Chr(10), where the latter sequence will work anywhere and
the two predefined constants pn work in a VBA procedure.

Your query would be something like:

UPDATE thetable
SET fld1 = fld1 & Chr(13) & Chr(10) & Chr(13) & Chr(10) &
fld2

--
Marsh
MVP [MS Access]
  #3  
Old May 25th, 2010, 03:12 AM posted to microsoft.public.access.queries
Allen Browne
external usenet poster
 
Posts: 11,706
Default adding a Carriage Return or Line Feed character to an update query

Chr(13) & Chr(10)

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"Paul" wrote in message
...
I'm building an update query that will concatenate two fields and update
the first field with the combination of the two fields. However, I would
like to separate the two components with a blank line, or two carriage
return or line feed characters. In Visual Basic, I'd use vbcr&vbcr to do
this. How can I do this in an update query?

Thanks in advance,

Paul

  #4  
Old May 26th, 2010, 01:37 AM posted to microsoft.public.access.queries
Paul
external usenet poster
 
Posts: 126
Default adding a Carriage Return or Line Feed character to an update query

Chr(13) & Chr(10) work great.

My thanks to Marsh and Allen.

I used the expression

SET fld1 = fld1 & Chr(13) & Chr(10) & Chr(13) & Chr(10) & fld2

and it put a blank line in between the two concatenated fields, which is
exactly what I was trying to accomplish.

Paul


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:49 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.