D
Darhl Thomason
My main form is in single form view. I have a combo box control
(cboDistrict) that updates based on the value of another combo box
(cboRegion). As I page through the records in my db, the cboDistrict does
not always show the value, even though there is a value in the table for
that record. If I click in the combo box, the correct value does display.
And, to make it even more fun...it seems to be random. I haven't seen a
pattern of when it displays normally (about 1/2 the time) and when it does
not display.
The code associated with this combo box is listed below. My hunch on the
problem is that it's tied to the Got Focus event. I originally had the code
in the cboRegion's After Update event, instead of the cboDistrict's Got
Focus event, but that was causing issues with all of the Districts showing
unless I changed the cboRegion to cause the After Update event to fire.
When I moved it to the cboDistrict's Got Focus event it now correctly only
lists the appropriate Districts for the given Region, but it also has the
above listed problem of not always showing the data even though the data is
really there.
Private Sub cboDistrict_GotFocus()
strSQL2 = "SELECT DistrictID, DistrictName " _
& " FROM tblDistrict WHERE RegionID = " & Me.cboRegion _
& " ORDER BY DistrictName"
Me.cboDistrict.RowSource = strSQL2
End Sub
Thanks!
Darhl
(cboDistrict) that updates based on the value of another combo box
(cboRegion). As I page through the records in my db, the cboDistrict does
not always show the value, even though there is a value in the table for
that record. If I click in the combo box, the correct value does display.
And, to make it even more fun...it seems to be random. I haven't seen a
pattern of when it displays normally (about 1/2 the time) and when it does
not display.
The code associated with this combo box is listed below. My hunch on the
problem is that it's tied to the Got Focus event. I originally had the code
in the cboRegion's After Update event, instead of the cboDistrict's Got
Focus event, but that was causing issues with all of the Districts showing
unless I changed the cboRegion to cause the After Update event to fire.
When I moved it to the cboDistrict's Got Focus event it now correctly only
lists the appropriate Districts for the given Region, but it also has the
above listed problem of not always showing the data even though the data is
really there.
Private Sub cboDistrict_GotFocus()
strSQL2 = "SELECT DistrictID, DistrictName " _
& " FROM tblDistrict WHERE RegionID = " & Me.cboRegion _
& " ORDER BY DistrictName"
Me.cboDistrict.RowSource = strSQL2
End Sub
Thanks!
Darhl