How to Requery combobox in subform based on unbound parent form listbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hbaf208
    New Member
    • May 2010
    • 7

    How to Requery combobox in subform based on unbound parent form listbox

    I have a combobox on a subform that is based on an SQL that uses a listbox on the unbound parent form as the criteria. When the form is first loaded, it works perfectly, limiting the dropdowns to only those associated with the listbox. However, when I update the listbox, I cannot get the combobox to requery. I've tried requery AfterUpdate on the listbox control, AfterUpdate on several subform controls, as well as trying to requery the combobox on several other events.

    Any suggestions?

    Thanks,
  • Jerry Maiapu
    Contributor
    • Feb 2010
    • 259

    #2
    Try to requery the sub form using its on current event. If not try on parent form's on crrent event..

    Just a suggest..

    Comment

    • mseo
      New Member
      • Oct 2009
      • 183

      #3
      hi,
      when you open your mainform and change the data in the listbox
      the combobox should have the same sql statement
      and could be updated using
      Code:
       private sub combo_box after_update()
      me.combo_box.requery
      end sub
      if you found the combobox un-updated in this case just select any other item within the combobox then redrop down combobox you will find the combobox updated
      hope this helps

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32633

        #4
        In the AfterUpdate event procedure for the ListBox on the main form add a call to .Requery the ComboBox on the subform. As you leave no name details I can only point you at Referring to Items on a Sub-Form for instructions on how to formulate the reference correctly.

        Welcome to Bytes!

        Comment

        • hbaf208
          New Member
          • May 2010
          • 7

          #5
          Thanks everyone. The On Current on the subform worked great. I had previously tried the afterupdate on the listbox on the mainform but I couldn't get it to work.

          Comment

          • Jerry Maiapu
            Contributor
            • Feb 2010
            • 259

            #6
            Welcome to bytes

            Comment

            Working...