我正在尝试点击按钮打开表单。以下是我的代码
Private Sub Command17_Click()
Dim stuff As String
Dim salaryStatus As String
stuff = "Senior Stuff"
salaryStatus = "Deposit"
sSQL = "SELECT CustomerT.* FROM CustomerT WHERE (((CustomerT.[Salary Status])=" & salaryStatus & ") AND ((CustomerT.[Stuff Type])= " & stuff & "));"
DoCmd.OpenForm "clusterF"
Forms!ClusterF.Form.RecordSource = sSQL
Forms!ClusterF.Form.Requery
Forms!ClusterF.Form.Refresh
End Sub
当我点击按钮时,我会看到一个小弹出窗口Enter parameter value stuff and salaryStatus
。为什么这个窗口显示。我的SQL查询有什么问题以及如何修复它?
答案 0 :(得分:-1)
是的,稍微减少它并重命名按钮:
Private Sub Command17_Click()
Dim stuff As String
Dim salaryStatus As String
stuff = "Senior Stuff"
salaryStatus = "Deposit"
sSQL = "SELECT CustomerT.* FROM CustomerT WHERE CustomerT.[Salary Status] = '" & salaryStatus & "' AND CustomerT.[Stuff Type] = '" & stuff & "';"
DoCmd.OpenForm "clusterF"
Forms!ClusterF.RecordSource = sSQL
End Sub