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 / Modules / DAO / VBA / March 2005

Tip: Looking for answers? Try searching our database.

Adding a "Linefeed" in a Label/Text Box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Eddie's Bakery and Cafe' - 28 Feb 2005 06:19 GMT
Hi, from my VBA code I am creating a dynamic control Label and Text Box.  I
need to force a "line feed" or "carriage return" in in the middle of the
text.  I tried adding a Chr(10)  and Chr(13) value to the string but this did
not work.  For example,

  Dim foo As String
  foo = " some text "
  foo = foo + Chr (13)     ' ASCII Carriage Return Char
  foo = foo + " some text"
  Me.TextBox.TEXT = foo

This code does not work.  Can someone provide a solution to this problem,

Thanks,
Signature

Eddie Eytchison

Jacco - 28 Feb 2005 08:07 GMT
> Hi, from my VBA code I am creating a dynamic control Label and Text Box.
> I
[quoted text clipped - 12 lines]
>
> Thanks,

Try this:

foo = foo & Chr (13)     ' ASCII Carriage Return Char
Eddie's Bakery and Cafe' - 28 Feb 2005 15:41 GMT
Hi Jacco,  I tried using the "&" but this did not work.  Do you have another
suggestion?

Thanks for your help

> > Hi, from my VBA code I am creating a dynamic control Label and Text Box.
> > I
[quoted text clipped - 16 lines]
>
> foo = foo & Chr (13)     ' ASCII Carriage Return Char
Mark - 28 Feb 2005 16:16 GMT
Try:
foo=foo & vbCrLf

> Hi Jacco,  I tried using the "&" but this did not work.  Do you have
> another
[quoted text clipped - 26 lines]
>>
>> foo = foo & Chr (13)     ' ASCII Carriage Return Char
David C. Holley - 01 Mar 2005 00:30 GMT
Actually try    foo = foo + Chr(13) + Chr(10)

>>Hi, from my VBA code I am creating a dynamic control Label and Text Box.
>>I
[quoted text clipped - 16 lines]
>
> foo = foo & Chr (13)     ' ASCII Carriage Return Char
fredg - 28 Feb 2005 16:39 GMT
> Hi, from my VBA code I am creating a dynamic control Label and Text Box.  I
> need to force a "line feed" or "carriage return" in in the middle of the
[quoted text clipped - 10 lines]
>
> Thanks,

In Access you must use the chr(13) & chr(10) combination
IN THAT ORDER.

= "Line 1." & chr(13) & chr(10) & "Line 2."

In VBA you can also use vbCrLf or vbNewLine.

[SomeControl] = "Line 1." & vbCrLf & "Line 2."

Signature

Fred
Please only reply to this newsgroup.
I do not reply to personal email.

Tim Ferguson - 28 Feb 2005 17:52 GMT
=?Utf-8?B?RWRkaWUncyBCYWtlcnkgYW5kIENhZmUn?= <eytchisoneb@hotmail.com>
wrote in news:77A5E588-BD2D-453F-8431-2BB2E8B1954C@microsoft.com:

>    Me.TextBox.TEXT = foo

You cannot access the Text property of a control (unless it has the focus).
Try

 Me!textbox.Value = "foo" & vbCrLf & "foo again"

HTH

Tim F
 
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.