我有大量的数据,我试图根据两个级联组合框进行整理。我收到错误Microsoft Access can't find the field '|1' referred to in your expression
并指出:
ElseIf [Forms]![Send To GE]![cboFil] = "LCP" Then
strSQL = "Select * From [To_GE] Where [Community] = " & Chr(34) & Me.cboSubFil.Value & Chr(34) And [LCP] = "& Chr(34) & Me.cboSSubFil.Value & Chr(34)"
Set rst = db.OpenRecordset(strSQL)
似乎And
应该适用于此。是什么导致了这个错误,我该如何解决?
答案 0 :(得分:3)
strSQL = "Select * From [To_GE] Where [Community] = " & Chr(34) & Me.cboSubFil.Value & Chr(34) And [LCP] = "& Chr(34) & Me.cboSSubFil.Value & Chr(34)"
应该是
strSQL = "Select * From [To_GE] Where [Community] = " & Chr(34) & Me.cboSubFil.Value & Chr(34) & " And [LCP] = " & Chr(34) & Me.cboSSubFil.Value & Chr(34)
为了让阅读更容易,我会建议在查询中转义引号或切换到单引号
strSQL = "Select * From [To_GE] Where [Community] = '" & Me.cboSubFil.Value & "' And [LCP] = '" & Me.cboSSubFil.Value & "'"