Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2002
    Location
    South Wales
    Posts
    580

    Red face Unanswered: Text box: displaying text with new lines

    Hello all;

    I have a text box on a form.

    The form is based on a query to an SQL table which stores address information from another application.

    If I open the ODBC table in design view the field is shown as type text, 160 characters, display as text box.

    Within the OTHER application, the text box is set with a behaviour similer to Enter key behaviour: New Line Feed.

    Therefore, when someone enters data in the OTHER application, it appears formatted like this;

    1 Acacia Avenue
    Smalltown
    Smallville

    I want my form to display the data in the same way

    The control on my form is a text box, but is displays the information like the attached .bmp

    It seems to be interpreting the (chr 13 / 10?) as a character rather than a line feed.

    On the "OTHER" tab for my text field, I have set Enter Key Behaviour as:New Line Feed

    My form is purely DISPLAYING the data - it is not "enabled" and is "locked"

    How can I get my form to format the address as described?

    Is this just a simple formatting issue? Or perhaps I have to write a small module to parse the SQL text and?

    Any suggestions would be helpful.

    GD
    Windows Server 2003-8 / Terminal Services / SQL 2000 / Access 2003 / Office 2003-7 / Exchange 2003-7 / Blackberry Enterprise Server / AutoCAD / Lambert And Butler / Red Bull

  2. #2
    Join Date
    Sep 2002
    Location
    South Wales
    Posts
    580

    bmp

    Missed the bmp!
    Attached Thumbnails Attached Thumbnails testcustomer.bmp  
    Windows Server 2003-8 / Terminal Services / SQL 2000 / Access 2003 / Office 2003-7 / Exchange 2003-7 / Blackberry Enterprise Server / AutoCAD / Lambert And Butler / Red Bull

  3. #3
    Join Date
    Sep 2002
    Location
    South Wales
    Posts
    580

    Solution

    I wrote a module to parse the address and replace chr(13) with chr(13) and chr(10)

    Public Function ParseAddress(strinput As Variant)

    Dim intStringLength As Integer
    Dim intCounter As Integer
    Dim strCharacter As String

    For intCounter = 1 To Len(strinput)

    strCharacter = Mid$(strinput, intCounter, 1)

    If strCharacter = Chr(13) Then

    ParseAddress = ParseAddress & Chr(13) & Chr(10)

    Else

    ParseAddress = ParseAddress & strCharacter

    End If

    Next intCounter

    End Function

    In the query behind the form, i created a field based on the result of this module;

    ParsedAddress: ParseAddress([AD_ADDRESS])

    ...and based the control source of the text box to ParsedAddress.

    Incidentally, it does not matter what enter key behaviour is set to in this example. (Not entering data)

    ...Simple really?...just like my brain!
    Attached Thumbnails Attached Thumbnails solution.bmp  
    Windows Server 2003-8 / Terminal Services / SQL 2000 / Access 2003 / Office 2003-7 / Exchange 2003-7 / Blackberry Enterprise Server / AutoCAD / Lambert And Butler / Red Bull

Posting Permissions

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