Hello all,
I have a main form with a combo box on it. When I select an item from combo box, it has to populate the subform. Actually, it works; but I have to click on the subform to get the subform populated. It takes a click.
Could it be possible to write a VBA code to update subform automatically without clicking on the form?
Regards,
lebi
Update the values of a subform on a mainform
-
- BronzeLounger
- Posts: 1498
- Joined: 01 Mar 2015, 02:03
-
- Administrator
- Posts: 78485
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Update the values of a subform on a mainform
You could create an After Update event for the combo box:
where Combo1 is the name of the combo box and Subform1 is the name of the subform as a control on the main form.
Code: Select all
Private Sub Combo1_AfterUpdate()
Me.Subform1.Requery
End Sub
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1498
- Joined: 01 Mar 2015, 02:03
Re: Update the values of a subform on a mainform
Hello Hans,
I started a new database, the second form was populated after I selected an entry from the combo box. However, I put the code on the after update event of combo box for days that the form doesn't get populated automatically. Very nice code.
Regards,
Biiiittt
I started a new database, the second form was populated after I selected an entry from the combo box. However, I put the code on the after update event of combo box for days that the form doesn't get populated automatically. Very nice code.
Regards,
Biiiittt