I'm trying to get my code to delete records from an access 2002 database table that is linked to an MS Sql 2008 database table through a form event. I just want it to delete all records where User is null and Date is null.
Here's the snippet that's giving me trouble:
Dim delSQL As String
DoCmd.SetWarnings False
delSQL = "DELETE * FROM Notifications WHERE User IsNull;"
Set rst = CurrentDb.OpenRecordset(delSQL, dbOpenSnapshot)
DoCmd.RunSQL delSQL
rst.Close
Set rst = Nothing
DoCmd.SetWarnings True
I honestly don't know why this isn't working. I ran the SQL statement above (not including the Date part as I wanted to get the User criteria working first) on the SQL server side and it works. But every time I try to get it to run in VBA for Access 2002, I get an error when it goes to execute the SQL.