Hi,
I have 2 tables
tbl_Docs with Fields:
- ID1 (Autonumber)
- DocRef (Integer)
- Others (Text)
tbl_DeleteList with fields
- ID2 (Autonumber)
- DocToDelete (Integer)
I want to write a query to delete those records in tbl_Docs where the DocRef matches the list in tbl_DeleteList (field DocToDelete)
I know how to do the simple delete for a single record
but I can't get it to work by reading the list in tbl_DeleteList. I've tried.....
And
I've derived the code from the Query Builder. I get error message
"Could not delete from specified tables"
Neither work - Can you help?
Thanks
I have 2 tables
tbl_Docs with Fields:
- ID1 (Autonumber)
- DocRef (Integer)
- Others (Text)
tbl_DeleteList with fields
- ID2 (Autonumber)
- DocToDelete (Integer)
I want to write a query to delete those records in tbl_Docs where the DocRef matches the list in tbl_DeleteList (field DocToDelete)
I know how to do the simple delete for a single record
Code:
DELETE tbl_docs.* FROM tbl_docs WHERE (((tbl_docs.DocRef)=2))
Code:
DELETE tbl_Docs.*, tbl_Docs.DocRef FROM tbl_Docs INNER JOIN tbl_DeleteList ON tbl_Docs.DocRef = tbl_DeleteList.DocToDelete
WHERE (((tbl_Docs.DocRef)=[tbl_DeleteList]![DocToDelete]))
Code:
DELETE tbl_Docs.*, tbl_Docs.DocRef FROM tbl_Docs, tbl_DeleteList WHERE (((tbl_Docs.DocRef)=[tbl_DeleteList]![DocToDelete]))
I've derived the code from the Query Builder. I get error message
"Could not delete from specified tables"
Neither work - Can you help?
Thanks