In the attached sql string, the alias "A" is not recognised at the first instance of "A.accession"
"Accession" is a valid field in the table "Discrepancies".
If I remove the alias and use the table name I get the same "variable not defined" error on "Discrepancies"
I have tried enclosing table and field names in [] to no avail.
"Accession" is a valid field in the table "Discrepancies".
If I remove the alias and use the table name I get the same "variable not defined" error on "Discrepancies"
I have tried enclosing table and field names in [] to no avail.
Code:
Public Function Corrected()
sQry = "DELETE FROM Discrepancies as A " & _
"WHERE A.Main_Jpg = '" & A.Accession & "' & AND " & _
"A.Main_Raw = '" & A.Accession & "' & AND " & _
"A.Main_Family = '" & A.Raw_Family & "' & or " & _
"A.Main_Family = '" & A.Spec_Family & "' & AND " & _
"A.Main_Box = '" & A.Raw_Box & "' & AND " & _
"A.SpellRaw = '" & False & "' & AND " & _
"A.SpellMain = '" & False & "' & AND " & _
"A.Spellspec = '" & False & "' & AND " & _
"A.nomatch = '" & False & "' & AND " & _
"A.SpellG = '" & False * "' & ;"
CurrentDb.Execute sQry, dbFailOnError
End Function