Requery Combo Box

L

LJG

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
 
G

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
 
M

microb0x

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.
 
L

LJG

Cheers Guys,

That's got it

Thanks Les


Klatuu said:
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
 
W

Wayne Morgan

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top