Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / SQL Server / ADP / February 2006

Tip: Looking for answers? Try searching our database.

How to insert a New Line into a text field?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ryan Langton - 15 Feb 2006 21:58 GMT
How do I insert a new line into an nvarchar field?

If I'm using Access, I can set the Enter key behavior for a text field to go
to a new line.  When I look at the table data, it appears as new lines.  If
I'm not using an Access form however to input the data (I want my VB code to
insert a new line and some text to the field), how do I do that?

Thanks,
Ryan
Douglas J. Steele - 15 Feb 2006 22:21 GMT
   Me.MyControl = "This is the first line." & vbCrLf & "This is the second
line."

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

> How do I insert a new line into an nvarchar field?
>
[quoted text clipped - 5 lines]
> Thanks,
> Ryan
Ryan Langton - 16 Feb 2006 21:37 GMT
Sorry I wasn't clear.  This would work if I have a control for said field on
the form.  I do not have a control (for this particular field) on the form.
When the user performs a certain action, I want to insert (directly into an
nvarchar field in my SQL database) a newline followed by text.  So for
example I would think I could do this with an UPDATE statement... 'UPDATE
table SET fieldA = fieldA + \n + "my added text"'... or something like that?

Thanks,
Ryan

>    Me.MyControl = "This is the first line." & vbCrLf & "This is the second
> line."
[quoted text clipped - 9 lines]
>> Thanks,
>> Ryan
Douglas J. Steele - 16 Feb 2006 23:27 GMT
Try SET fieldA = fieldA + Char(13) + Char(10) + "my added text"'

(Char(13) is Carriage Return, Char(10) is Line Feed)

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

> Sorry I wasn't clear.  This would work if I have a control for said field
> on the form.  I do not have a control (for this particular field) on the
[quoted text clipped - 20 lines]
>>> Thanks,
>>> Ryan
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.