Results 1 to 3 of 3
  1. #1
    Join Date
    May 2009
    Posts
    41

    Unanswered: Is it possible to have the first entry of a Combo box be "Add New Item to List"?

    I have several combo boxes on a form that are used for filtering, and instead of having several buttons located next to each combo box (to add an item based on the filters above it) I want to have the first entry of each combo box to be "Add New Item."

    After it's clicked, the appropriate form will pop-up in modal mode.

    Each combo box is already linked to a query that updates the list.

    Is it possible to do this?

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    yes, providing you populate the combo box yourself

    IIRC you need to select the data required, add it to the rowsource collection seperating each vlaue with a semi colon. you need to set the datasource to a value list or some such

    so if you have a 2 column combo thats
    -1;"Add new Item";10;"Widgets";15;"Spanners"

    ..and so on.
    the code to populate the combo probably needs to be put into the forms on activate event

    the psuedo code will be soemhtign like
    clear combo
    strComboText='-1;"Add New Item";
    strSQL = "select blah,di,blah from my table order by acolumn"
    open the recordset
    iterate through each item
    add each item to the strcombotext
    loop
    assign the value of strcombotext to the appropriate property of the combo box

    however 'Add New Item' sounds like an odd use of the combo box design paradigm
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    May 2009
    Posts
    41
    Quote Originally Posted by healdem
    yes, providing you populate the combo box yourself

    IIRC you need to select the data required, add it to the rowsource collection seperating each vlaue with a semi colon. you need to set the datasource to a value list or some such

    so if you have a 2 column combo thats
    -1;"Add new Item";10;"Widgets";15;"Spanners"

    ..and so on.
    the code to populate the combo probably needs to be put into the forms on activate event

    the psuedo code will be soemhtign like
    clear combo
    strComboText='-1;"Add New Item";
    strSQL = "select blah,di,blah from my table order by acolumn"
    open the recordset
    iterate through each item
    add each item to the strcombotext
    loop
    assign the value of strcombotext to the appropriate property of the combo box

    however 'Add New Item' sounds like an odd use of the combo box design paradigm
    Thanks, healdem.

    I agree. It's an odd request, but I suppose that's just how it is sometimes...

    :shrug:

Posting Permissions

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