Hi I’m trying to convert some old queries into VBA to be run on the Fly. I’m having a problem with this.
When this is run from the Query builder in Ms Access it does what it is supposed to (delete all files that are after the date given as long as they don’t have anything in the comment box).
When I run this from VBA it deletes everything except for those records with a comment, for some reason it takes no account of the date part.
Any ideas?
Code:
[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]strSQLhistory = "DELETE tblCasualtyHistory.PeriodStartDate, tblCasualtyHistory.Comment, * FROM tblCasualtyHistory WHERE PeriodStartDate >31/12/ 2004 And Comment is null;"
DoCmd.RunSQL strSQLhistory[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]
When this is run from the Query builder in Ms Access it does what it is supposed to (delete all files that are after the date given as long as they don’t have anything in the comment box).
When I run this from VBA it deletes everything except for those records with a comment, for some reason it takes no account of the date part.
Any ideas?