Cascading combo boxes not updating

Lol999

Registered User.
Local time
Today, 09:01
Joined
May 28, 2017
Messages
184
having some fun and games with two cascading comboboxes on my form.
basically, after selecting a value in the 1st the second is updating but what I can only describe as th underlying value is not, and hence the subform which is displaying records (in theory) based upon the combobox values is inaccurate.

I'm also having problems with Null values which I have tried to offset by setting default values for the comboboxes.

Anyway, here's the offending code, and a copy of the latest database is attached.
Thanks, Lol

Code:
Private Sub cboCategory_AfterUpdate()
Me.cboProduct_Picker.Requery
Dim Category As String ' Tool Category to filter data to cboProduct_Picker
Dim Product As String   ' Part number to filter records for subform
Me.cboCategory.SetFocus
Category = Me.cboCategory.Text
Me.cboProduct_Picker.SetFocus
Debug.Print Me.cboProduct_Picker.Column(0)

    ' Set source records for use to choose product based upon category selected in cboCategory
     Me.cboProduct_Picker.RowSource = "Select Tbl_Product.ID_Product, Tbl_Product.Part_No, Tbl_Product.Details From Tbl_Product Where Tbl_Product.Tool_Category='" & Category & "';"
     
        
    
With Me.frm_Current_Location_Subform
      If IsNull(Me.cboProduct_Picker) Then
        .LinkChildFields = ""
        .LinkMasterFields = ""
      Else
        .LinkChildFields = "ID_Product"
        .LinkMasterFields = Me.cboProduct_Picker.Column(0)
        End If
   End With

    
    
End Sub
 

Attachments

cboCountry
cboCity
the sql for cboCity looks at cboCountry
select city from table where country = forms!myForm!cboCountry

BUT you must refresh the list when user changes cboCountry
Code:
sub cboCountry_afterupdate()
   cboCity.requery
end sub
 

Users who are viewing this thread

Back
Top Bottom