Results 1 to 10 of 10

Thread: How do I insert a line return in an unbound text box

  1. #1
    Join Date
    Apr 2013
    Location
    Laurel, MD
    Posts
    27

    Question How do I insert a line return in an unbound text box

    Hello everyone,

    I am using an unbound text box in access 2007 and I need to create a line return in that box. Meaning I need to enter the fields name in the box control source code so the output will look as follows:

    Dewberry, Inc.
    1234 Oxford St,
    Suite 309
    Lahnam, MD 20706

    Thanks for the help.

  2. #2
    Join Date
    May 2006
    Posts
    407
    Try the variable "vbLF"

  3. #3
    Join Date
    Apr 2013
    Location
    Laurel, MD
    Posts
    27
    Morning...how do I code it in. I have never used that variable before. Do I use the unbound text box control code or the VBA editor.

  4. #4
    Join Date
    May 2006
    Posts
    407
    You gave two possible ways to use this variable. What was the result of your two tests? BTW, vbLF gets its name from Visual Basic, Line Feed (or new line).

  5. #5
    Join Date
    Apr 2013
    Location
    Laurel, MD
    Posts
    27
    Thanks for the definition.

    As I said, I have never used the variable "vbLF" before. I was asking if I can use it in an unbound text box or should I use it in the VBA editor windows?

    Right now I have an unbound text box that I used to format the employee name, title and phone number (i.e: John Doe, Manager 555-555-1234). The code used in the control source of the unbound text box is: =[Firnam] & " " & [Lasnam] & "," [Titl] & " " & [Phonb].

    Can I use that same code to format the address and add in the "vbLF" variable? If yes, what code do I use?

    Thanks.

  6. #6
    Join Date
    May 2006
    Posts
    407
    What I'm trying to do is help you figure this out for yourself. If you have a variable (really a constant), that will produce a line-feed, where could you put it in code you already have?
    BTW, vbCRLF would be a better constant to use in this case. vbCRLF is equal to (the same as) what happens when you press the "Enter" key within a text field. "CRLF" stands for Carriage Return, Line Feed. I'm really hoping you will try a few things on your own based on this information.

  7. #7
    Join Date
    Apr 2013
    Location
    Laurel, MD
    Posts
    27
    Thanks GolferGuy. Will work with it and see what I get.

  8. #8
    Join Date
    Apr 2013
    Location
    Laurel, MD
    Posts
    27
    Problem solved using the following string:
    Me.textboxname = Me.[CyNam] & vbCrLf & Me.[CySt] & "," & Me.[CySteNb] & vbCrLf & Me.[CyCity] & "," & Me.[CySta] & " " & Me.[CyZip]

    Thanks for the help.

  9. #9
    Join Date
    May 2006
    Posts
    407
    Excellent job! I do hope it was helpful to you that I did not give you the answer, but let you experience the joy of personal discovery.

  10. #10
    Join Date
    Apr 2013
    Location
    Laurel, MD
    Posts
    27
    Morning...Yes. Thank you.

Posting Permissions

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