none
Requering a combo box after a value has been added in a pop-up linked form RRS feed

  • Question

  • Greetings

    I created a combo box (PlaceID) on Form A which links to the Place Table. On Form A, I placed a button which opens a pop-up Form B where new places can added. On addition of the new places and saving, these are not reflected in the combo box unless I close and reopen Form A.

    What would be the best way to requery the combo box to show the newly added values when I save and close, the pop-up Form B?

    Thanks in advance

    Saturday, November 25, 2017 4:31 AM

All replies

  • I would wish this does not interfere with the "List Items Edit Form" function I have applied, for which the Edit Form is Form B
    Saturday, November 25, 2017 5:09 AM
  • Open the form with code like this:

        DoCmd.OpenForm "FormB", _
            DataMode:=acFormAdd, _
            Windowmode:=acDialog

        Me.PlaceID.Requery

    By opening the form in dialogue mode code execution will be paused until FormB has been closed or hidden.  The Requery method will then be called, adding any new items to the combo box's list.

    I've assumed that the combo box's Name property is PlaceID as well as this being the name of the column to which it is bound.

    Ken Sheridan, Stafford, England

    Saturday, November 25, 2017 3:20 PM
  • Hi,

    Another option is to use the Combobox GotFocus event and simply use something like:

    Me.ComboboxName.Requery

    Hope it helps...

    Saturday, November 25, 2017 6:01 PM