Access combobox requery
I have two comboboxs, one is used to control another. So in the AfterUpdate event of the combo_1, I do a requery for combo_2 to force it to update its list according to the value chosen in combo_1. But my code doesn't.
Private Sub combo1_AfterUpdate()
Dim strSQL As String
Select Case Me.combo1.Column(1)
Case "Production"
Me.combo2.Visible = True
strSQL = "SELECT id_prod FROM tblProd;"
Me.combo2.ControlSource = strSQL
Me.combo2.Requery
Case Else
Me.combo2.Visible = False
End Select
End Sub
There is nothing in the开发者_如何学运维 combo_2 when i choose "Production" in combo_1. The requery clause is executed but no effect.
Unless the syntax has changed in later version you should change the line
Me.combo2.ControlSource=strSQL
To
Me.combo2.RowSource=strSQL
Try that because otherwise it looks good
精彩评论