我在查询表达式中收到错误'语法错误(缺少运算符):
'tblFICL.Product = Muni/Money Market AND tblFICL.Broker_Code = WELLS'
完整的vba查询如下。我猜这与我的变量prdct
和bkr
有关。我在这个查询中缺少什么语法?
'Set and Excecute SQL Command'
strSQL = "SELECT tblFICL.Email " _
& " FROM tblFICL " _
& " WHERE tblFICL.Product = " & prdct & " AND tblFICL.Broker_Code = " & bkr & ""
整天看着这一切,任何帮助都会受到极大的关注。
答案 0 :(得分:4)
您可能需要在值之前和之后使用撇号。请尝试以下代码
strSQL = "SELECT tblFICL.Email " _
& " FROM tblFICL " _
& " WHERE tblFICL.Product = '" & prdct & "' AND tblFICL.Broker_Code = '" & bkr & "'"