update subform from main form

D

DeVille

Hi I have a subform which is linked to my main form by a
combo box. So that if I choose a customers name on the
main form in the combo box [CustomerName] the customer's
address details appear in the subform. The problem I am
having is that when I change the value in the combo box
on the main form, I have to go to the next record on the
main form then come back and the address details are in
the subform. I would like to have my subform work so the
address details update as soon as I change the customers
name on the main form. If any one can help thanks in
advance
 
K

Ken Snell

Put this code on the combo box's AfterUpdate event:

Private Sub cboBoxName_AfterUpdate()
Me.Subform.Requery
End Sub

where Subform is the name of the subform control (the control that holds the
subform).
 

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