Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2002
    Location
    Bay Area
    Posts
    511

    Question Unanswered: Punctuated text added to list box is split

    I need your help in solving why punctuated text gets split and some of it lost when added to a list box. In this instance, two lines are added to the list box instead of one. The split is at the position of the comma. The comma and semi-colon are omitted, all text following the semi-colon does not get into the list box. The code:
    Code:
    Dim txtString As String
    txtString = "The cabin looked deserted, and half covered with snow; and it would soon be dark."
    Me.lstScript.AddItem txtString
    A blank database with one form is attached to demonstrate what is happening.
    Thanks.
    Jerry
    Attached Files Attached Files

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Code:
    txtString = """The cabin looked deserted, and half covered with snow; and it would soon be dark."""
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    pootle's example will take care of you. Google up "ms access escape quotes" if you want to know why.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  4. #4
    Join Date
    Jan 2002
    Location
    Bay Area
    Posts
    511
    Thank you pootle flump for your response. I am using Access 2003 and maybe that causes your solution of using quotes like this: """text; more text""" to split the text when using AddItem with a list box, as it did for me without the extra quotes. It appears that the Access AddItem method treats the punctuated text as delimited strings separated by commas or semi-colons.

    The solution I am using is a temporary table to hold strings of text. This table is the row source for the list box, and now the text appears intact in the list box.
    Jerry
    RESOLVED

Posting Permissions

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