Results 1 to 11 of 11

Thread: combo box

  1. #1
    Join Date
    Jun 2008
    Posts
    59

    Unanswered: combo box

    i have a combo box which drops down a list of names from a table,works fine ,but when i select an entry from the combo box i also want to delete it from the list?? any help would be appreciated rgds a (newbie) dennis!

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    depending on how you populated the list box.....
    Im not certain you can delete items in a lsit box if the list box's control source is set to a query or table.

    if you have populated the list box yourself then its dooable. in these circumstances the data is actaully stored in a collection.... you can shunt values form one list box to another, you can insert values in a specific order.

    have a look at the properties and methods of the combo box, specifically the add and delete methods
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Delete what from what list?
    George
    Home | Blog

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Healdem: if it's bound, then you run a delete query and requery the list
    George
    Home | Blog

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    yeah, agreed

    ...but that alters the underlying data, which in my interpretation of where I think the OP is coming from is something not required. I read it as the OP wants to move an item form a combo box for that record.. Im thinking it something like a dual linked listbox such as the columns available / columns selected you see in the report designer.....
    I'd rather be riding on the Tiger 800 or the Norton

  6. #6
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Isn't it great fun guessing what the OP really wants?
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  7. #7
    Join Date
    Jun 2008
    Posts
    59

    combo boxes

    Quote Originally Posted by georgev
    Delete what from what list?
    sorry i did not explain myself i have populated a combo box using a table query. i can select individual names from the combo and place them in text boxes bound to another table. this all works fine but i want to remove the selected name from the combo after it is selected so that it cannot be selected twice?
    rgds dennis the menace!

  8. #8
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Then the query for the combo box needs to exclude those names that are already in your text boxes.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  9. #9
    Join Date
    Jun 2008
    Posts
    59
    Quote Originally Posted by StarTrekker
    Then the query for the combo box needs to exclude those names that are already in your text boxes.
    thankyou that sounds fine but how do i exclude the names already selected automatically?

  10. #10
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    In the SQL for your combo box, you need to have criteria such as:

    Not forms!formname!textbox1name And Not forms!formname!textbox1name ... etc
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  11. #11
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    id use an unbound combo (mind you I'd be more tempted to use an unbound list box)
    I'd populate it in he forms on current event (taking account of any userid's already defined on viewing/editing the record)
    id delete the selected userid/name from in the combo's on click/on selected event
    i'd allow the name to be reinserted if required (i'd probably use a list box on the 'selected' side)

    the query appraoch woudl work, but it does mean you are doing more work on the data (requerying every time)
    you'd be having to build a series of names to exclude in the where/in clause

    personally it makes more sense to go unbound, there should be no need to revisit the datastore having captured the names once.

    if there are not to many names/userid's id be tempted to stuff 'em into an array or other local store so you don't hit the netwrok each time.
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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