Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2013
    Posts
    70

    Unanswered: Populate combo box from popup form

    Hello all, I have what is a puzzle to me. I have combo box that I have code in so that when i double click it another form pops up and I add a record to the table the combo box gets it's data from. That works fine. Now,it seems to me that in order to maintain my "do nothing the computer can do" ways, I would like it if the record I just added in the popup form to populate the combo box. The double click event to add a record is only used when creating a new record in the form. So when the user clicks the new record star in the record numbers box at the bottom of the form, then double clicks the cbo and adds the record can that data populate the cbo? Thanks, Scott

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    If the popup form adds a row to the table that is used as the RowSource for the combo, you can always requery the combo after the addition of the new row.
    Have a nice day!

  3. #3
    Join Date
    Mar 2013
    Posts
    70

    Populate combo box from popup form

    Thanks for the response. The popup form does get it's data from the same place as the cbo. This is the code that runs on the close form event for the popup form: Forms!frmInventory!cboItemLU.Requery

    The requery works fine in that when I close the popup form, I can then select the new item. It is there immediately. But I would like to have the new line automatically inserted in the cbo if I added the popup item into a new blank record on the form with the cbo. I hope this is clear. If I am misunderstanding your answer I apologize. Best, Scott

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    in the popup forms after update event you shoudl be able to force a requery of the parent form's combo box


    so put the same code into the forms afterupdate event.
    there is no way of addign a single value to a combo box unless the combo box rowsourcetype is value list, where you can use the .additem method. if the rowsource is a table/query then the only way of adding something is to add to the underlying table and requery
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Mar 2013
    Posts
    70

    Populate combo box from popup form

    Hello, I tried putting the code in the after update event of the popup form. The requery continues to work perfectly, but it does not populate the combo box. If I start at a new blank record, then the cbo is blank after the popup form closes. If I start in an existing record, the record stays the same (a good thing).

    This is not a big deal. I am at the stage where I am tweaking little annoyances (mine) that if I could fix them, it would be great but it will not be the end of the world if not. This is now becoming a learning experience. Any other thoughts are welcome. If not I will be content that the requery works flawlessly and be happy. Best, Scott

Tags for this Thread

Posting Permissions

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