Trying to update rowsource of Combobox based on value selected on another ComboBox

dimanche 26 avril 2015

Hi I am trying to use a combobox called Manufacturer to select which table the combobox called Model gets it's rowsource from using the code below.

Code:

Private Sub Manufacturer_AfterUpdate()
    If (Me.Manufacturer.Value = "Siemens") Then
         
        Me.Model.RowSourceType = "Table/Query"
        Me.Model.Recordset = "SeimensTable"
        Me.Model.RowSource = "SELECT Model FROM SeimensTable"
     
    Else
        If (Me.Manufacturer.Value = "Samsung") Then
           
            Me.Model.RowSourceType = "Table/Query"
            Me.Model.Recordset = "SamsungTable"
            Me.Model.RowSource = "SELECT Model FROM SamsungTable"
        End If
    End If
End Sub

But when I run the form and select Manufacturer. Combobox Model remains empty. Can Anyone tell me what I'm doing wrong?
Trying to update rowsource of Combobox based on value selected on another ComboBox

0 commentaires:

Enregistrer un commentaire

Labels