Results 1 to 9 of 9
  1. #1
    alyon is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2011
    Posts
    89

    Line Break in Textbox

    In Access 2007, can someone tell me how to populate a textbox with a line break?

    =[Forms]![Violations]![cboSection4] & i want the line break here & [Forms]![Violations]![cboSection5]



    I feel like this should be simple, but I can't figure it out.
    Thanks for the help!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    =[Forms]![Violations]![cboSection4] & Chr(13) & Char(10) & [Forms]![Violations]![cboSection5]
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    the code is & vbcrlf & (VB carriage return line feed pair)

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    vbCrLf won't work in a control (textbox, listbox, etc), at least not in my test effort
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Quote Originally Posted by June7 View Post
    vbCrLf won't work in a control (textbox, listbox, etc), at least not in my test effort
    That is completely correct. vbCrLf is ONLY good in VBA. Control sources or in queries you need to use Chr(13) & Chr(10) and it is good to note that it needs to be in that order (just in case someone missed it).

  6. #6
    alyon is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2011
    Posts
    89
    Chr(13) & Chr(10) works perfect! thank you! :]

  7. #7
    merlin777 is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Sep 2011
    Posts
    117
    Quote Originally Posted by alyon View Post
    Chr(13) & Chr(10) works perfect! thank you! :]
    I hope its not too late to ask' is there a way to do this without code (e.g. in excel it's 'ALT-ENTER')

  8. #8
    accessnewbie352 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2015
    Posts
    46
    Quote Originally Posted by merlin777 View Post
    I hope its not too late to ask' is there a way to do this without code (e.g. in excel it's 'ALT-ENTER')
    This is probably a bit too late given the time the question was asked but i stumbled on this when googling the answer myself. I used "Ctrl" + "Enter" directly in the text box via the design view and it worked.

  9. #9
    rgi is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2015
    Posts
    1

    Textbox Text Format = Plain Text works, but Rich Text does not

    I found that the text format affects whether the Chr(13) & Chr(10) works or not. (i.e. Text Format = Plain Text works, but Rich Text does not) Ctrl + Enter in 2010 had no affect by itself, but only made it more readable in the textbox.

    Quote Originally Posted by accessnewbie352 View Post
    This is probably a bit too late given the time the question was asked but i stumbled on this when googling the answer myself. I used "Ctrl" + "Enter" directly in the text box via the design view and it worked.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 04-11-2011, 03:58 PM
  2. How to do line by line compare of VB code?
    By Buakaw in forum Access
    Replies: 2
    Last Post: 02-14-2011, 11:46 PM
  3. Replies: 5
    Last Post: 12-06-2010, 10:15 AM
  4. page break problem
    By simba in forum Reports
    Replies: 0
    Last Post: 11-30-2010, 10:39 AM
  5. Alphabet break in report
    By amccook in forum Reports
    Replies: 8
    Last Post: 08-27-2010, 03:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums