vb6 Using SQL 'Delete From' with a date
Posted on 2006-04-13
In a vb6 app which draws data from an Access 2000 database, I want to delete all records that are 7 or more days old. The following deletes all records regardless of date. ActDate is a date/time field
Dim dCutOff As Date
dCutOff = DateAdd("d", -7, Date)
sSQL = "DELETE FROM activity where ActDate" & " < " & "#" & dCutOff & "#;"
Set rs = cn.Execute(sSQL, , adCmdText)
What's wrong, and what should be done to fix the problem, please