我有一个组合框cboDept,当单击它时将其值设置为'dept'(全局)。然后,它使另一个组合框cboBldAddress可见并将其设置为具有焦点。执行时,cboBldAddress组合永远不会加载。飞行员的错误在哪里?为简洁起见,我删除了其他Case语句。
Private Sub cboDept_Click()
dept = cboDept.Value
Me.cboBldAddress.Visible = True
Me.cboBldAddress.SetFocus
End Sub
Private Sub cboBldAddress_GotFocus()
Dim sql As String
Select Case dept
Case "Administrative"
ssql = "select address from building where department = 'Administration'"
cboBldAddress.RowSourceType = "Table/Query"
cboBldAddress.RowSource = ssql
Me.cboBldAddress.Requery
End Select
End Sub
答案 0 :(得分:0)
声明不正确。声明
Dim ssql As String
它应该工作。 启用
Option Explicit
在每个模块中,您将避免此类难以发现的问题