New line in query? char(13)? (1 Viewer)

robyholmes

Registered User.
Local time
Today, 00:30
Joined
Mar 2, 2009
Messages
57
I am trying to make a memo box full of information to be exported to excel, I need to use new lines to make is easier to read.

I have tried vbNewLine and Char(13) both with errors? Can it be done. Here is the code:
Code:
ApptNotes: 
"Name: " & [tblCustomer]![title] & " " & [tblCustomer]![first_name] & " " & [tblCustomer]![last_name] 
& char(13) & "Address: " & [tblCustomer]![address_line_1] 
& char(13) & "            " & [tblCustomer]![address_line_2] 
& char(13) & "            " & [tblCustomer]![address_line_3] 
& char(13) & "            " & [tblCustomer]![city] 
& char(13) & "            " & [tblCustomer]![county] 
& char(13) & "            " & [tblCustomer]![postcode] 
& char(13) & "Home Tel: " & [tblCustomer]![home_tel] 
& char(13) & "Mob: " & [tblCustomer]![mob_tel] 
& char(13) & "Email:  " & [tblCustomer]![email] 
& char(13) & "Notes: " & [tblCustomer]![notes] 
& char(13) & char(13) & "Cottage: " & [tblbooking]![cottage] 
& char(13) & "Nights Booked: " & [tblbooking]![nights_booked] 
& char(13) & "Adults: " & [tblbooking]![adults] 
& char(13) & "Children: " & [tblbooking]![children]
 

robyholmes

Registered User.
Local time
Today, 00:30
Joined
Mar 2, 2009
Messages
57
Thanks a lot, worked great.
 

Rabbie

Super Moderator
Local time
Today, 00:30
Joined
Jul 10, 2007
Messages
5,906
Also you may find you need to use chr(10) & chr(13) to put in both cr and lf characters.
 

Rabbie

Super Moderator
Local time
Today, 00:30
Joined
Jul 10, 2007
Messages
5,906
What will this do?
I have found I often need to have both Carriage return and linefeed in between lines to ensure correct formatting of the output. You may not need it but it won't do any harm
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 00:30
Joined
Sep 12, 2006
Messages
15,634
i think the usage is old teletype terminal stuff
line feed advances, and carriage return takes printhead to start of line
i suppose linefeed on its own, may not automatically start at the beginning of line, although vb text boxes dont seem to store phantom spaces, if you will - you see this behaviour in some text editors, where moving the cursor down a line doesnt necessarily go back to the start of a line, even on previously blank lines

note that vb has constants for these and many other circumstances

vbcr, vblf, and VBCRLF - most useful
also vbtab and many others
 

Users who are viewing this thread

Top Bottom