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 / Forms Programming / August 2005

Tip: Looking for answers? Try searching our database.

Line break in textboxs

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Angela 'Angel' Brown - 03 Aug 2005 15:01 GMT
I'm trying to create a line break in a text box and it wont work. I can get
it to work in a message box just not a text box

any suggestions?

code -
text box:
   txtbox.Value = txtbox.Value + (Chr(13)) + StrMessage
message box:
   MsgBox (txtbox.Value + (Chr(13)) + StrMessage)
David Cleave - 03 Aug 2005 15:25 GMT
Hi Angela

For some bizarre reason unknown to sane people, you have to use chr(13) with
chr(10). I can't remember which way round, but obviously you can find that
out pretty easily.

Cheers

David

> I'm trying to create a line break in a text box and it wont work. I can get
> it to work in a message box just not a text box
[quoted text clipped - 6 lines]
> message box:
>     MsgBox (txtbox.Value + (Chr(13)) + StrMessage)
Klatuu - 03 Aug 2005 17:05 GMT
Chr(13) & Chr(10) have been around since the beginning of time.  It is the
code for Carriage Return (Chr(13)) and Line Feed (Chr(10)).  Back in the days
of Noah, it was a printer control signal to move the print head all the way
to the left and andvance the paper one line.
There are two equivilants in VBA you can use:
vrCrLf or vbNewLine

txtbox.Value = txtbox.Value & vbNewLine & StrMessage

Also note the change from the + to the &
In VBA, + is really a math operator and & is for concatenating strings.

> Hi Angela
>
[quoted text clipped - 16 lines]
> > message box:
> >     MsgBox (txtbox.Value + (Chr(13)) + StrMessage)
Angela 'Angel' Brown - 04 Aug 2005 09:04 GMT
Thanks - worked a treat

> Chr(13) & Chr(10) have been around since the beginning of time.  It is the
> code for Carriage Return (Chr(13)) and Line Feed (Chr(10)).  Back in the days
[quoted text clipped - 28 lines]
> > > message box:
> > >     MsgBox (txtbox.Value + (Chr(13)) + StrMessage)
 
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.