Hello vbforums
I have 3 tables as shown below
I want to delete all records that are in both tbl1 and tbl3 but do not exist in tbl2
![Name: query3.jpg
Views: 40
Size: 43.1 KB]()
this is what I'm doing but no success.
In this scenarion I expect this query to delete Record 4 in Tbl1 and Tbl3.
thank you
I have 3 tables as shown below
I want to delete all records that are in both tbl1 and tbl3 but do not exist in tbl2
this is what I'm doing but no success.
Code:
StrSql = "Select * From Tbl1 inner join Tbl2 on Tbl1.Id = Tbl2.PID " & _
" inner join Tbl3 on Tbl1.ID = Tbl3.SID" & _
" where pass = 'Non' and PID <> SID "
Set Rs = Cnn.OpenRecordset(StrSql)
If Not Rs.EOF Then
Do While Not Rs.EOF
Rs.Delete
Rs.MoveNext
Loop
End If
End If
thank you