访问组合框重新查询
我有两个组合框,一个用于控制另一个。因此,在combo_1 的AfterUpdate 事件中,我对combo_2 进行重新查询,以强制它根据combo_1 中选择的值更新其列表。但我的代码没有。
Private Subcombo1_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
EndSub
当我在combo_1中选择“生产”时,combo_2中没有任何内容。 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
除非语法在更高版本中发生了变化,否则您应该更改“尝试”行
,
否则它看起来不错
Unless the syntax has changed in later version you should change the line
To
Try that because otherwise it looks good