Results 1 to 5 of 5
  1. #1
    rcrobman is offline Not Expert Yet!
    Windows XP Access 2007
    Join Date
    Apr 2011
    Location
    Toronto
    Posts
    73

    Word Wrap in Access VB (MSAccess 2007)


    Is there a way to have a word wrap function in the Access VB window in Access 2007? When writing code quite often the code is much bigger than the window BUT if you hit enter to wrap the code manually the software takes it as a new instruction line. I have tried putting & before or after the new line but to no avail. It would be a lot simpler to follow the code if you didn't have to scroll across the window to keep reading it!
    I have looked at all the menu options and don't see one to accomplish this.
    Thanks if you can tell me what I am missing!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    To my knowledge there's no automatic way. The combination of a space and an underscore is VBA's line continuation character, which lets you write code on multiple lines:

    Code:
      strSQL = "SELECT Count(*) AS HowMany FROM CarMaint.dbo.Car_Records " _
             & "WHERE car_no = " & varCarNum & " AND Company_no = '" & Me.CarComp & "'"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    rcrobman is offline Not Expert Yet!
    Windows XP Access 2007
    Join Date
    Apr 2011
    Location
    Toronto
    Posts
    73
    Well that would explain why all the code examples that MS shows in the help file show the _ & .
    I thought it was just showing that the code continued but was being displayed that way!
    Thanks for the help!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problemo!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    caddcop is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Feb 2011
    Location
    Upper Marlboro, Maryland, USA
    Posts
    57
    Note that you cannot use the _ in the middle of a string. IOW, you cannot do...
    "This is some very long string _
    that continues on two lines"
    You can however, do this...
    "This is some very long string "_
    & "that continues on two lines"
    When is a line of code, the underscore is fine.

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

Similar Threads

  1. Learn MSAccess by playing MSAccess Jeopardy
    By pkstormy in forum Sample Databases
    Replies: 4
    Last Post: 11-17-2016, 07:27 AM
  2. Wrap line
    By devcon in forum Reports
    Replies: 1
    Last Post: 10-22-2010, 09:46 AM
  3. Replies: 5
    Last Post: 10-19-2010, 08:02 AM
  4. is it possible to integrate word to access 2007
    By tintincute in forum Access
    Replies: 7
    Last Post: 09-28-2010, 05:04 AM
  5. wrap text
    By kamolrat in forum Reports
    Replies: 1
    Last Post: 11-17-2009, 01:36 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