Dim myDate As Date
myDate = CDate(Date)
SQL = " Select Count(PONumber) As OverDue from tblPO where POExpireDate < '" & myDate & "'"
Set db = CurrentDb
Set rs = db.OpenRecordset(SQL)
我运行此代码....在OpenRecordset它显示错误...
标准表达式中的数据类型不匹配。
我现在应该怎么做...为什么这个错误来了?
当Date
返回当前日期时,您只需要在SQL中直接使用Date()
:
SQL = "Select Count(PONumber) As OverDue from tblPO where POExpireDate < Date()"