Rowsource values

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a subform that has combo boxes. The row source values for these combo boxes are based on a value from a field in the main form (in a query). This works fine when the correct value in the main form is selected. An example would be if I select "Day shift" the start time field is populated with the times for the day shift to start. If I select "Day Shift" but go back and change it to "Night Shift" the row source values in the combo box are still for the day side. It is only changed when I close and reopen the form.
 
Bob said:
I have a subform that has combo boxes. The row source values for
these combo boxes are based on a value from a field in the main form
(in a query). This works fine when the correct value in the main form
is selected. An example would be if I select "Day shift" the start
time field is populated with the times for the day shift to start. If
I select "Day Shift" but go back and change it to "Night Shift" the
row source values in the combo box are still for the day side. It is
only changed when I close and reopen the form.

It sounds like you need to requery the dependent combo box on the
subform in the AfterUpdate event of the "Shift" combo box on the main
form. For example, assuming that the main form's combo box is named
"Shift", the subform's combo box is "ShiftTime", and the name of the
subform control (the control on the main form that holds the subform) is
"sfShiftData", then you might have this AfterUpdate event procedure for
the Shift combo box:

Private Sub Shift_AfterUpdate()

Me.sfShiftData.Form!ShiftTime.Requery

End Sub
 
Why 2 posts for the same question?

One post is suffice!

Van T. Dinh
MVP (Access)


-----Original Message-----
I have a subform that has combo boxes. The row source
values for these combo boxes are based on a value from a
field in the main form (in a query). This works fine when
the correct value in the main form is selected. An example
would be if I select "Day shift" the start time field is
populated with the times for the day shift to start. If I
select "Day Shift" but go back and change it to "Night
Shift" the row source values in the combo box are still
for the day side. It is only changed when I close and
reopen the form.
 
Back
Top