Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Jan 2001
    Location
    Kansas, USA
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    multiple lines in text box (A2000)

    How do you have one text box on a form, yet have several fields displayed, for example, one text box that would include a Name field, address field, city, state, & postal code field on separate lines.

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: multiple lines in text box (A2000)

    >>How do you have one text box on a form, yet have several fields displayed, for example, one text box that would include a Name field, address field, city, state, & postal code field on separate lines.<<

    First of all, I have a "new line" function in a module, so I can call it from anywhere:
    <pre>Public Function NL( ) as variant
    NL = vbCrLf
    End Function
    </pre>


    Then in a query or in a controlsource for a control on a report or form, you just concatentate the fields using the NL() to generate the line breaks. Such code might look like this:
    <pre>FirstName & " " & LastName & _
    NL() + Address1 & _
    NL() + Address2 & _
    NL() & City & ", " & State & " " & Zip
    </pre>

    Notice that I sometimes used + instead of &. This services the purpose of eliminating blank lines. So if Address2 is Null, then NL() + Address2 will also be Null, so no new line will be generated.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

Posting Permissions

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