Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Requery Combo Box

Discussion in 'Information Technology' started by LJG, Jul 28, 2006.

Tags:
  1. LJG

    LJG
    Expand Collapse
    Guest

    Hi Guys,

    I have a hidden txt box that holds a value from a combo box and need another
    combo box in a subform to requery when the value is changed. I have tried

    Private Sub txtsup_AfterUpdate()
    Me.frmGoodsSub!cboprodlist.Requery
    End Sub

    But this does not work, can anyone tell me what I need to change to get this
    to work

    TIA
     
  2. Klatuu

    Klatuu
    Expand Collapse
    Guest

    The AfterUpdate event of a control does not fire if the value is changed
    programmatically. It would probably be best to do it immediately after you
    assign the value to the text box. I would assume you are doing that in the
    After Update event of the first combo, so:

    Me.txtBox = Me.Combo1
    Me.Combo2.Requery

    "LJG" wrote:

    > Hi Guys,
    >
    > I have a hidden txt box that holds a value from a combo box and need another
    > combo box in a subform to requery when the value is changed. I have tried
    >
    > Private Sub txtsup_AfterUpdate()
    > Me.frmGoodsSub!cboprodlist.Requery
    > End Sub
    >
    > But this does not work, can anyone tell me what I need to change to get this
    > to work
    >
    > TIA
    >
    >
    >
     
  3. microb0x

    microb0x
    Expand Collapse
    Guest

    How does this hidden text box get populated? Is it after the combo box
    is updated? If this is the case, requery the combo on your subform
    after the other combo is updated.

    Dont quote me on this, but I believe if your hidden text box is getting
    fed a value from an action elsewhere on the form (i.e. my example
    above) the "after_update" event for the hidden txt box is not occuring.
    I think after_update would only occur if the user updates that hidden
    txt box, not if its updated via code or macro.


    LJG wrote:
    > Hi Guys,
    >
    > I have a hidden txt box that holds a value from a combo box and need another
    > combo box in a subform to requery when the value is changed. I have tried
    >
    > Private Sub txtsup_AfterUpdate()
    > Me.frmGoodsSub!cboprodlist.Requery
    > End Sub
    >
    > But this does not work, can anyone tell me what I need to change to get this
    > to work
    >
    > TIA
     
  4. LJG

    LJG
    Expand Collapse
    Guest

    Cheers Guys,

    That's got it

    Thanks Les


    "Klatuu" <Klatuu@discussions.microsoft.com> wrote in message
    news:9D9E9320-EF59-42B4-B41F-BC5C2B24F5C8@microsoft.com...
    > The AfterUpdate event of a control does not fire if the value is changed
    > programmatically. It would probably be best to do it immediately after
    > you
    > assign the value to the text box. I would assume you are doing that in
    > the
    > After Update event of the first combo, so:
    >
    > Me.txtBox = Me.Combo1
    > Me.Combo2.Requery
    >
    > "LJG" wrote:
    >
    >> Hi Guys,
    >>
    >> I have a hidden txt box that holds a value from a combo box and need
    >> another
    >> combo box in a subform to requery when the value is changed. I have tried
    >>
    >> Private Sub txtsup_AfterUpdate()
    >> Me.frmGoodsSub!cboprodlist.Requery
    >> End Sub
    >>
    >> But this does not work, can anyone tell me what I need to change to get
    >> this
    >> to work
    >>
    >> TIA
    >>
    >>
    >>
     
  5. Wayne Morgan

    Wayne Morgan
    Expand Collapse
    Guest

    What you need to do will depend on what is causing the value of the textbox
    to change. The textbox's AfterUpdate event fires after the textbox updates
    its Text property to its Value property. This is done when a user manually
    types a value into the textbox. Since the textbox is hidden, this isn't
    being done. What are you doing to change the value of the textbox?

    --
    Wayne Morgan
    MS Access MVP


    "LJG" <lj_girvan@no_spam_hotmail.com> wrote in message
    news:eO5bRegoGHA.1140@TK2MSFTNGP05.phx.gbl...
    > Hi Guys,
    >
    > I have a hidden txt box that holds a value from a combo box and need
    > another combo box in a subform to requery when the value is changed. I
    > have tried
    >
    > Private Sub txtsup_AfterUpdate()
    > Me.frmGoodsSub!cboprodlist.Requery
    > End Sub
    >
    > But this does not work, can anyone tell me what I need to change to get
    > this to work
    >
    > TIA
    >
    >
     
  6. Pieter Wijnen

    Pieter Wijnen
    Expand Collapse
    Guest

    another way is to add Combo1_Afterupdate to the code

    Pieter

    "LJG" <lj_girvan@no_spam_hotmail.com> wrote in message
    news:uju9W8goGHA.4872@TK2MSFTNGP04.phx.gbl...
    > Cheers Guys,
    >
    > That's got it
    >
    > Thanks Les
    >
    >
    > "Klatuu" <Klatuu@discussions.microsoft.com> wrote in message
    > news:9D9E9320-EF59-42B4-B41F-BC5C2B24F5C8@microsoft.com...
    >> The AfterUpdate event of a control does not fire if the value is changed
    >> programmatically. It would probably be best to do it immediately after
    >> you
    >> assign the value to the text box. I would assume you are doing that in
    >> the
    >> After Update event of the first combo, so:
    >>
    >> Me.txtBox = Me.Combo1
    >> Me.Combo2.Requery
    >>
    >> "LJG" wrote:
    >>
    >>> Hi Guys,
    >>>
    >>> I have a hidden txt box that holds a value from a combo box and need
    >>> another
    >>> combo box in a subform to requery when the value is changed. I have
    >>> tried
    >>>
    >>> Private Sub txtsup_AfterUpdate()
    >>> Me.frmGoodsSub!cboprodlist.Requery
    >>> End Sub
    >>>
    >>> But this does not work, can anyone tell me what I need to change to get
    >>> this
    >>> to work
    >>>
    >>> TIA
    >>>
    >>>
    >>>

    >
    >




    --
    ----------------------------------------
    I am using the free version of SPAMfighter for private users.
    It has removed 4182 spam emails to date.
    Paying users do not have this message in their emails.
    Get the free SPAMfighter here: http://www.spamfighter.com/len
     

Share This Page