The code below works and deletes records that are older then two years from the tblWaarschuwingen table.
Code:
Dim dteExpiry As Date
Dim strSQLDelete As String
dteExpiry = DateAdd("yyyy", -2, Date)
strSQLDelete = "DELETE from tblWaarschuwingen WHERE tblWaarschuwingen.datum2 <= #" & dteExpiry & "#;"
DoCmd.RunSQL strSQLDelete
If i try to do exaclty the same on another table but then date minus seven days, it fails !
Code:
Dim dteExpiry2 As Date
Dim strSQLDelete2 As String
dteExpiry2 = DateAdd("d", -7, Date)
strSQLDelete2 = "DELETE from tblBlauweKaart WHERE tblBlauweKaart.Kaart_tot <= #" & dteExpiry2 & "#;"
DoCmd.RunSQL strSQLDelete2
What am i missing here ?