Results 1 to 5 of 5

Thread: Listbox load question

  1. #1
    New Member
    Join Date
    Jun 06
    Posts
    7

    Listbox load question

    I use Access 2003 with VBA and managed to create a dual list box feature that allows me to pick from left and copy to right. I set it up to copy the items instead of moving them and I can do multiple selections. It works great for lists up to several hundred, but is sluggish at 1100 or so names.

    I feed the results to a table so I can use it in a query to limit the matching records in the selection. That was easier than creating a humongous SQL statement.

    It works pretty well until I have a list with embedded commas in the text. The additem function splits the entry at the comma. Last name, first name turns into last name on one row and first name on the next.

    Does any one have a way to tell additem to ignore embedded commas?

    I would also be happy to share this routine should anyone want a copy.

    Thanks.

  2. #2
    Frenzied Member pnish's Avatar
    Join Date
    Aug 02
    Location
    Tassie, Oz
    Posts
    1,915

    Re: Listbox load question

    Quote Originally Posted by kfinpgh
    The additem function splits the entry at the comma.
    It shouldn't, and in fact I just tried it and it didn't. Perhaps there is some other (non visible) data embedded in the string which is causing your problem, eg a linefeed or carriage return etc
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

  3. #3
    New Member
    Join Date
    Jun 06
    Posts
    7

    Re: Listbox load question

    I am using VBA, which may behave differently than VB6. If there were other characters in the field, Access would split the contents of the field in other operations.

  4. #4
    Super Moderator Hack's Avatar
    Join Date
    Aug 01
    Location
    Searching for mendhak
    Posts
    58,283

    Re: Listbox load question

    Access VBA question moved to Office Development
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  5. #5
    New Member
    Join Date
    Jun 06
    Posts
    7

    Re: [RESOLVED]Listbox load question

    I used findandreplace() to change the comma to " and ". I reverse the process when the listbox contents are used in a multi-item selection table. That turns the " and " back into the comma.

    Works OK for a small list, but 11 names can take a while.

Posting Permissions

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