Answered by:
Error 3128 when trying to delete records

Question
-
I am attempting to debug an application done with MS Access 2010. There is a failure with error 3128 - specify the table containing the records you want to delete. This happens on the first step of a macro that opens a query with the following statement:
DELETE [Receivelog Details].*, Receivelog.[ROR No]
FROM Receivelog INNER JOIN [Receivelog Details] ON Receivelog.[ROR No] = [Receivelog Details].[ROR No]
WHERE (((Receivelog.[ROR No])=[forms]![Do Manifests].[selectROR]));
I am able to execute a datasheet view with query and get the correct results, so I don't think there is a problem with the WHERE section. I am confused as to why it feels I have not specified the table.
Any assistance would be greatly appreciated!!
W. Brown
wallybrown61@hotmail.com
Wednesday, January 20, 2016 6:33 PM
Answers
-
As you are restricting the query by a parameter on the key, why do you need to reference the ReceiveLog table at all?
DELETE *
FROM [Receivelog Details]
WHERE [ROR No] = [Forms]![Do Manifests].[selectROR];
The only reason I can think of is that there are rows in Receivelog Details without a match in Receivelog, which you want to retain. This would be unusual as it is normally the case that it is rows without a match which are to be deleted, not the reverse.
BTW I'd strongly advise against including your email address in a post to a public forum like this; it's an open invitation to spammers to harvest it. If you do need to cite the address then mung it, e.g. wallybrown61<at>Hotmail<dot>comKen Sheridan, Stafford, England
- Marked as answer by David_JunFeng Friday, January 29, 2016 9:43 AM
Thursday, January 21, 2016 4:41 PM
All replies
-
>>>There is a failure with error 3128 - specify the table containing the records you want to delete. This happens on the first step of a macro that opens a query with the following statement:
According to your description, if using an inner join in conjunction with a delete query (which can sometimes be a problem), so I suggest you could try this instead:
DELETE [Receivelog Details].* FROM [Receivelog Details] WHERE ((([Receivelog Details].[ROR No]) In (SELECT Receivelog.[ROR No] FROM Receivelog INNER JOIN [Receivelog Details] ON Receivelog.[ROR No] = [Receivelog Details].[ROR No] WHERE (((Receivelog.[ROR No])=[forms]![Do Manifests].[selectROR])));
In addition could you provide more information about your issue, for example macro code, screenshot etc., that will help us reproduce and resolve it.
Thanks for understanding.Thursday, January 21, 2016 6:38 AM -
As you are restricting the query by a parameter on the key, why do you need to reference the ReceiveLog table at all?
DELETE *
FROM [Receivelog Details]
WHERE [ROR No] = [Forms]![Do Manifests].[selectROR];
The only reason I can think of is that there are rows in Receivelog Details without a match in Receivelog, which you want to retain. This would be unusual as it is normally the case that it is rows without a match which are to be deleted, not the reverse.
BTW I'd strongly advise against including your email address in a post to a public forum like this; it's an open invitation to spammers to harvest it. If you do need to cite the address then mung it, e.g. wallybrown61<at>Hotmail<dot>comKen Sheridan, Stafford, England
- Marked as answer by David_JunFeng Friday, January 29, 2016 9:43 AM
Thursday, January 21, 2016 4:41 PM