sqlmsde

How do I delete files from a table in MSDE 2000 that is selected by 3 joins?


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


Solution

  • 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 #.