Reputation: 1
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)
Im running this code....at OpenRecordset its shows error...
Data Type Mismatch in Criteria Expression.
What should i do now...why this error Coming?
Upvotes: 0
Views: 55
Reputation: 56026
As Date
returns the current date, all you need is to use Date()
directly in the SQL:
SQL = "Select Count(PONumber) As OverDue from tblPO where POExpireDate < Date()"
Upvotes: 1