2

I have a VB6 program that uses a n Access backend. The query that I am currently using is

sQuery = "DELETE tblResultNotes.* " & _
             "FROM (tblJobs INNER JOIN tblResults ON tblJobs.JobID=tblResults.JobID) INNER JOIN tblResultNotes ON tblResults.ResultID=tblResultNotes.ResultID " & _
             "WHERE (tblJobs.CreateDate)< #" & strDate & "# " & _
             "AND tblResults.StartTime < #" & strDate & "#;"

I have changed my backend to MSDE 2000 and now this query is giving me a syntax error near '*'. Could someone help me out?

Thanks, Tom

Fionnuala
  • 90,370
  • 7
  • 114
  • 152
MagnumPI
  • 25
  • 6
  • possible duplicate of [How to delete in MS Access when using JOIN's?](http://stackoverflow.com/questions/5585732/how-to-delete-in-ms-access-when-using-joins) – ypercubeᵀᴹ Dec 14 '11 at 20:59
  • Not a dupe. OP has changed from Access to MSDE so now it's not a delete from Access issue anymore. – squillman Dec 14 '11 at 21:21

1 Answers1

1

Try changing your SQL to this:

sQuery = "DELETE FROM tblREsultNotes " & _
"FROM " & _
"    tblJobs" & _
"    INNER JOIN tblResults ON tblJobs.JobID=tblResults.JobID" & _
"    INNER JOIN tblResultNotes ON tblResults.ResultID=tblResultNotes.ResultID" & _
"WHERE tblJobs.CreateDate < '" & strDate & "'" & _
"AND tblResults.StartTime < '" & strDate & "'"

Note the date delimiter change to ' instead of #.

squillman
  • 13,363
  • 3
  • 41
  • 60