none
Requery a combobox on the parent form from subform RRS feed

  • Question

  • Hi Access pros, 

    I am trying to requery a combobox on the parent form. I have the following code in the afterupdate event of a textbox on the subform.

    Me.Parent!cboAddProduct.Requery

    The code runs without errors, but the combobox options don't change as expected: it's as if the combobox values are always 1 requery behind.

    I noticed that f I manually click the refresh button on the Access ribbon, the combobox options are properly updated.

    Thanks for the help.

    Wednesday, January 4, 2017 4:32 AM

Answers

  • Hi,

    if the combobox contents depend on what you have done in the subform's record then it could help to save the current changes in this record. e.g. like this

    Me.Dirty = False
    Me.Parent!cboAddProduct.Requery

    If instead the problem is related to network latency, complex queries as rowsource etc. then usually it helps to replace the Requery by the heavier updating method:

    Me.Parent!cboAddProduct.RowSource = Me.Parent!cboAddProduct.RowSource


    Karl

    • Marked as answer by SL02 Wednesday, January 4, 2017 6:51 PM
    Wednesday, January 4, 2017 12:31 PM

All replies

  • Hi

    For refresh, try this

    Me.Parent.Parent!cboAddProduct.Refresh

    Refer to Form and Subform properties and controls


    Best // Peter Forss Stockholm and Sigtuna GMT +1.00


    Wednesday, January 4, 2017 7:08 AM
  • Hi,

    if the combobox contents depend on what you have done in the subform's record then it could help to save the current changes in this record. e.g. like this

    Me.Dirty = False
    Me.Parent!cboAddProduct.Requery

    If instead the problem is related to network latency, complex queries as rowsource etc. then usually it helps to replace the Requery by the heavier updating method:

    Me.Parent!cboAddProduct.RowSource = Me.Parent!cboAddProduct.RowSource


    Karl

    • Marked as answer by SL02 Wednesday, January 4, 2017 6:51 PM
    Wednesday, January 4, 2017 12:31 PM
  • Added the line

    If Me.Dirty Then Me.Dirty = False

    and now works just as expected. Thank you!

    Wednesday, January 4, 2017 6:51 PM