Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1

    Unanswered: Pass a string with commas to a listbox

    I'm sure there's a vba function for this, but I can't find it for the life of me.

    The application for this is populating a list box. I have a mutli-column list box that is populated based on a string stored in a single field. I have no problems using this method UNLESS the string being passed has a "," . In which case, it creates a new column. Is there a way to explicitly pass the comma as part of the string value for the row?

    Since I know my first question would be, "But Teddy, why don't you just make more fields for each possible preference and assign it as the datasource to the listbox." I'll answer to that now.



    The primary function of this code is to populate a listbox containing user preferences for any given report. Each report may have a variable number of preferences associated with it. Therefore, each report has a field that contains the names and column widths for the preference listbox, which I split and assign when needed. That's not a problem at all.

    Then in the report preferences table, the preference itself is stored as a ";" deliminated string, as there are many, many, many different possible preferences for each different report, and this is the only way to avoid immense bloat.

  2. #2
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    Does the string in the field that you are storing this list in look like this:


    Test 1;Test2;Testing, 1;Testing, 2

    or does it look like this:

    "Test 1";"Test2";"Testing, 1";"Testing, 2"

    It should look like the second, with embedded double-quotes.

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Originally posted by PracticalProgram
    Does the string in the field that you are storing this list in look like this:


    Test 1;Test2;Testing, 1;Testing, 2

    or does it look like this:

    "Test 1";"Test2";"Testing, 1";"Testing, 2"

    It should look like the second, with embedded double-quotes.
    That sir, was the angle I was looking for. I'll run a quick query to parse that and let you know what happened.

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Well, I had to do some bizarre trickery, but it works.

    Thanks a bunch!!

Posting Permissions

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