473,651 Members | 2,468 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL chr(10) & chr(13)

Hi,

I'm trying to concatenate address fields and insert a LF&CR after each line.
The SQL I use is based on

select
address1 & chr(10) & chr(13)&
address2 & chr(10) & chr(13)&
address3 & chr(10) & chr(13)&
address4 & chr(10) & chr(13)&
address5 & chr(10) & chr(13) &
postcode as Address
from addresses

However, although this works for some records, it doesn't for all of them!
Also on some records, only some of the newlines work, so I get results like:

1 A. Drive Someplace Somewhere
Somecounty
Somepostcode

(where I would like the first line split into 3)

It really does seem to work completely randomly!

Please help,
Chris
Nov 12 '05 #1
6 91630
> I'm trying to concatenate address fields and insert a LF&CR after each line.
The SQL I use is based on


The sequence is CR & LF, e.g. Chr(13) & Chr(10) or vbCrLf

HTH - Peter

--
No mails please.
Nov 12 '05 #2
I'm trying to concatenate address fields and insert a LF&CR after each line.
The SQL I use is based on


The sequence is CR & LF, e.g. Chr(13) & Chr(10) or vbCrLf


Of course, the intrinsic constants will not work in SQL, only in VBA, so one
must use the combination "Chr(13) & Chr(10)" in sql statements and in
form/report control sources.

--
Bruce M. Thompson, Microsoft Access MVP
bt******@mvps.o rg (See the Access FAQ at http://www.mvps.org/access)
NO Email Please. Keep all communications

within the newsgroups so that all might benefit.<<
Nov 12 '05 #3
"Peter Doering" <ne**@doering.o rg> wrote in message
news:bk******** ****@ID-204768.news.uni-berlin.de...
I'm trying to concatenate address fields and insert a LF&CR after each line. The SQL I use is based on


The sequence is CR & LF, e.g. Chr(13) & Chr(10) or vbCrLf

HTH - Peter


Thanks, that sorted it..

I wonder why the other way worked sometimes but not others?

Chris
Nov 12 '05 #4
>>> I'm trying to concatenate address fields and insert a LF&CR after each line.
The SQL I use is based on
The sequence is CR & LF, e.g. Chr(13) & Chr(10) or vbCrLf

Of course, the intrinsic constants will not work in SQL, only in VBA, ...


Very true. Thanks, Bruce.

Peter

--
No mails please.
Nov 12 '05 #5
I wonder why the other way worked sometimes but not others?


You're likely referring to the MsgBox() function, where a simple Chr(13) will
give you the new line (in this case the "Chr(10)" is ignored). This is a unique
situation.

:-)
--
Bruce M. Thompson, Microsoft Access MVP
bt******@mvps.o rg (See the Access FAQ at http://www.mvps.org/access)
NO Email Please. Keep all communications

within the newsgroups so that all might benefit.<<
Nov 12 '05 #6
IF the UN could work together so peacefully...ha haha
Nov 12 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
7957
by: paddy_nyr | last post by:
I converted an Access 97 db to Access 2002 db and I now get the following error message when I try and run a query. Thanks Here's my query. SELECT DISTINCTROW tblCo_Info.Co_id, & Chr(13) & Chr(10) & & IIf(Trim()<>"",Chr(13) & Chr(10) & ,"") & Chr(13) & Chr(10) & IIf(Trim()<>"",Trim() & ", ","") & & " " & AS
1
8355
by: jdph40 | last post by:
I am trying to enter text to look like paragraphs in a text box on a report, making it look like a memo. I enter (Chr$(13) & Chr$(10) & Chr$(10)) to insert a carriage return and 2 line breaks, but a small black square prints on the report. If I enter Chr$(10) once, the square doesn't print. Can you only have one line break? TIA, JD
2
18116
by: lauren quantrell | last post by:
Has anyone cunstructed a function to remove multiple carriage returns and replace it with a single return? Replace(mytext, Chr(13) & Chr(10) & Chr(13) & Chr(10), Chr(13) & Chr(10)) ... only works to remove double carriage returns. Thanks. lq
2
3846
by: MLH | last post by:
I run the following command in main menu form open event code... Me!MainMenuLabel.Caption = DLookup("", "qryAdminList") & Chr$(10) & Chr$(13) & DLookup("", "qryAdminList") & Chr$(10) & Chr$(13) & DLookup("", "qryAdminList") The caption on the label is not what I want at all. All 3 dlookups return valid strings. Its the carriage returns and line feeds. They are showing as literal characters instead of doing what I'd hoped for.
2
11382
by: crjunk | last post by:
I have the following code in my web page. Dim tmpReplace As String 'Giving tmpReplace the value from the textbox on the webform. tmpReplace = txtComments.Text.Trim 'Prevents report from crashing when a single quote is in string tmpReplace = tmpReplace.Replace("'", "''") 'Replace carriage return with the appropriate CharCodes.
0
1501
by: WebMatrix | last post by:
Hello, I am noticing that text data comming from Web Service to client comes back with chr(10) /n only, rather than chr(10) + chr(13) /n/r. I checked through a breakpoint in web service text data does have /n/r, but on a client side, it comes out as /n. It causes formatting issues in older VB6 clients’ textboxes and on some reports. Is this by design, or some web service config issues?
3
53285
by: ics3djc | last post by:
Hi. Is there a way to remove carriage returns and line feeds from a field in SQL. Here is what I have at the moment: CAST(m.Description AS VARCHAR(8000))AS "Product Description" (have had to cast as VarChar because of problems with aggregate functions in rest of query).
5
7728
by: Computer Guru | last post by:
I have a form I'm using as a dialog box. It has default text that is two paragraphs. It has a function setText(byval text as string) that specifies the text in the read-only textbox that's on it. For some odd reason, dialog1.setText("Line 1" & chr(13) & chr(13) & "Line 2") shows up as "Line 1Line 2" on Vista, and as "Line 1Line2" on 2k3, where is an
17
4730
by: AWW | last post by:
Using Textbox.Text = "123" & CStr(13) & "456" I expect 2 lines on the screen but get 1 line with 13 in it. It worked once in a RichTextBox but then stopped. I just want to display aligned tabular data on the screen using CR & Tabs to create data columns. I am an old programmer but .Net novice.<g> Help.
0
8275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8795
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8695
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8460
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8576
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6157
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4281
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1906
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.