Requery Combobox

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ApexData@gmail.com

    #1

    Requery Combobox

    I have a ComboBox, when dblClicked, displays the combobox's row
    content in a continuous
    subform. Changes can be made to this content in the subform and then
    closed. The ComboBox needs to be requeried to immediately reflect
    these changes. The problem is that I can't requery in the OnDblClick
    event of the ComboBox because the event completes once the subform is
    launched. I guess I could requery the combobox from the Close event of
    the subform, however I don't know how to recognize the combobox
    control that called the subform, since there are many comboboxes that
    will call this subform.

    Any suggestions???

    Greg

  • Bruce

    #2
    Re: Requery Combobox

    On Feb 7, 3:12 pm, "ApexD...@gmail .com" <ApexD...@gmail .comwrote:
    I have a ComboBox, when dblClicked, displays the combobox's row
    content in a continuous
    subform. Changes can be made to this content in the subform and then
    closed. The ComboBox needs to be requeried to immediately reflect
    these changes. The problem is that I can't requery in the OnDblClick
    event of the ComboBox because the event completes once the subform is
    launched. I guess I could requery the combobox from the Close event of
    the subform, however I don't know how to recognize the combobox
    control that called the subform, since there are many comboboxes that
    will call this subform.
    >
    Any suggestions???
    >
    Greg
    You say that there are 'many comboboxes that will call this subform'.
    I take this to mean that there is one continuous form that is used as
    a subform by many different forms. If that is the case, I would first
    make sure that the combobox that you are trying to refresh on each
    parent form has the same name, e.g. "cboList". Then in the
    afterupdate event of the continous form that you are using as a
    subform simply include the line

    Me.Parent!cboLi st.Requery

    HTH,
    Bruce

    Comment

    • ApexData@gmail.com

      #3
      Re: Requery Combobox

      Bruce I have one MainForm that contains many comboboxes. Each
      combobox can be dblclicked to bring up a single continuous style
      subform. This subform has been designed as one form that can be
      called by any combobox and reveals that comboboxes content and allows
      it to be edited.

      I believe I need to pass the ControlName to a dummy txtbox on the
      continuous subform. Do you know how to automatically determine the
      control name that has the focus, rather thnn me specifically spelling
      it out for each control ???

      ThankYou
      greg

      Comment

      • paii, Ron

        #4
        Re: Requery Combobox


        <ApexData@gmail .comwrote in message
        news:1170883733 .397952.39440@v 33g2000cwv.goog legroups.com...
        Bruce I have one MainForm that contains many comboboxes. Each
        combobox can be dblclicked to bring up a single continuous style
        subform. This subform has been designed as one form that can be
        called by any combobox and reveals that comboboxes content and allows
        it to be edited.
        >
        I believe I need to pass the ControlName to a dummy txtbox on the
        continuous subform. Do you know how to automatically determine the
        control name that has the focus, rather thnn me specifically spelling
        it out for each control ???
        >
        ThankYou
        greg
        >
        You could have the combo box after update event set a value in a hidden
        control on the Parent form to identify it self. Then use that value in the
        sub form to requry the calling combo box.


        Comment

        • Jana

          #5
          Re: Requery Combobox

          On Feb 8, 6:23 am, "paii, Ron" <p...@packairin c.comwrote:
          <ApexD...@gmail .comwrote in message
          >
          news:1170883733 .397952.39440@v 33g2000cwv.goog legroups.com...
          >
          Bruce I have one MainForm that contains many comboboxes. Each
          combobox can be dblclicked to bring up a single continuous style
          subform. This subform has been designed as one form that can be
          called by any combobox and reveals that comboboxes content and allows
          it to be edited.
          >
          I believe I need to pass the ControlName to a dummy txtbox on the
          continuous subform. Do you know how to automatically determine the
          control name that has the focus, rather thnn me specifically spelling
          it out for each control ???
          >
          ThankYou
          greg
          >
          You could have the combo box after update event set a value in a hidden
          control on the Parent form to identify it self. Then use that value in the
          sub form to requry the calling combo box.
          Greg:

          I would take a look at the OpenArgs argument of the DoCmd.OpenForm
          method. You could pass the name to the popup, and have the requery
          done in the Close event of the popup.

          Here's some air code (I use A97):

          Main Form combo box's DoubleClick Event:
          DoCmd.OpenForm "PopUpFormName" , , , , , , "ComboBoxNa me"

          Pop Up Form's Close Event:
          Forms!MainFormN ame.SetFocus
          DoCmd.Requery Me.OpenArgs

          HTH,
          Jana

          Comment

          • Bruce

            #6
            Re: Requery Combobox

            On Feb 8, 9:26 am, "Jana" <Bauer.J...@gma il.comwrote:
            On Feb 8, 6:23 am, "paii, Ron" <p...@packairin c.comwrote:
            >
            >
            >
            <ApexD...@gmail .comwrote in message
            >
            news:1170883733 .397952.39440@v 33g2000cwv.goog legroups.com...
            >
            Bruce I have one MainForm that contains many comboboxes. Each
            combobox can be dblclicked to bring up a single continuous style
            subform. This subform has been designed as one form that can be
            called by any combobox and reveals that comboboxes content and allows
            it to be edited.
            >
            I believe I need to pass the ControlName to a dummy txtbox on the
            continuous subform. Do you know how to automatically determine the
            control name that has the focus, rather thnn me specifically spelling
            it out for each control ???
            >
            ThankYou
            greg
            >
            You could have the combo box after update event set a value in a hidden
            control on the Parent form to identify it self. Then use that value in the
            sub form to requry the calling combo box.
            >
            Greg:
            >
            I would take a look at the OpenArgs argument of the DoCmd.OpenForm
            method. You could pass the name to the popup, and have the requery
            done in the Close event of the popup.
            >
            Here's some air code (I use A97):
            >
            Main Form combo box's DoubleClick Event:
            DoCmd.OpenForm "PopUpFormName" , , , , , , "ComboBoxNa me"
            >
            Pop Up Form's Close Event:
            Forms!MainFormN ame.SetFocus
            DoCmd.Requery Me.OpenArgs
            >
            HTH,
            Jana
            This is a good idea, but the original poster specified use of a
            subform rather than a popup form. Frankly I prefer popups for this
            sort of thing because you do get to use OpenArgs.

            There are several ways to let your subform be aware of which control
            was initially double-clicked and a hidden textbox (either on the
            parent form or the subform) is probably as good as any. For each
            combobox on the main form you'll want to set the value of the hidden
            textbox in the combobox's dblclick event using something like

            txtHidden = Me.ActiveContro l.Name

            if txtHidden is on the parent form, or

            subForm.Form!tx tHidden = Me.ActiveContro l.Name

            if txtHidden is on the subform.

            Bruce

            Comment

            Working...