Results 1 to 5 of 5

Thread: Chr(13) Problem

  1. #1
    Join Date
    Jul 2002
    Location
    Island of Dots
    Posts
    316

    Unanswered: Chr(13) Problem

    I'm using a text box (txtContextHelp) to display relevent help to the user upon entering each field on a form. For txtContextHelp, I have the EnterKeyBehaviour set to NewLineInField. However, the following code displays a small block character instead of a new line in the field (irrespective of what font I use):

    Code:
    txtContextHelp = "Line 1" & Chr(13) & "Line 2"
    Anyone with any ideas as to how I can get around this?

  2. #2
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Very odd...

    Have you tried using the constant vbCrLF instead of Chr(13)?
    Inspiration Through Fermentation

  3. #3
    Join Date
    Aug 2003
    Posts
    29

    Smile

    Chr(13) is an "unprintable" character. The program will display a block for unprintable characters. Use vbCRLF.

  4. #4
    Join Date
    Jul 2002
    Location
    Island of Dots
    Posts
    316
    According to this ASCII table (http://www.asciitable.com/), Chr(13) is a carriage return. If I press Alt+013 in a textbox which allows input (and has its EnterKeyBehaviour set to NewLineInField) then the cursor goes to the next line in the field, as it should do. Eitherway, vbCrLF seems to work fine. Thanks a lot.

  5. #5
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303
    Both the vbCrlf and Chr(13) both work great in vb code when using the Access dialogue message.

    msgbox "Dear user. You are blah blah blah " & Chr(13) & "Second line."

    But when printing to a form, the vbCrlf is the only thing that works. See also vbTab and others below (compliments of Access Help).

    vbCrLf..............Chr(13) + Chr(10)
    vbCr................Chr(13)
    vbLf.................Chr(10)
    vbNewLine........Chr(13) + Chr(10) or Chr(13)
    vbNullChar.......Chr(0)
    vbTab..............Chr(9)
    vbBack............Chr(8)
    vbFormFeed.....Chr(12)
    vbVerticalTab...Chr(11)

    good day
    John
    This is the day the Lord has made, I will rejoice and be glad in it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •