VBA从字段where和子句中选择计数

时间:2017-03-27 15:42:44

标签: excel-vba ms-access excel-2007 vba excel

这似乎很简单但我在执行以下vba语句时遇到错误:

Dim currentmth As String
currentmth = Sheets("Data").Range("f3") ----this stores the month name
strSql = "SELECT count(Emails_Submitted) As Total FROM tablename WHERE Emails_Submitted > 1 '" & tc_mth = currentmth & "'"

cn.Open strConnection
Set rs = cn.Execute(strSql)
countfrmdb = rs.Fields(0)
cellref = countfrmdb

错误消息:无效的sql语句

0 个答案:

没有答案
相关问题