Dustin Stanley
asked on
MS Access DELETE Query Parameter Error Not Finding Query Field
I am trying to make a DELETE query. I want to DELETE all fields in a table for every record found in a query.
Query:
(ImportChildrenPartsCSV.ID Key) is the table
and
[qryImportFindDuplicatesDE LETE].[IDK ey] is the query
Everytime I run it. It asks for the parameter for
[qryImportFindDuplicatesDE LETE].[IDK ey]
Thought this was pretty straight forward but I don't get it. Thanks for the help.
Query:
DELETE *
FROM ImportChildrenPartsCSV
WHERE (ImportChildrenPartsCSV.IDKey)=[qryImportFindDuplicatesDELETE].[IDKey];
(ImportChildrenPartsCSV.ID
and
[qryImportFindDuplicatesDE
Everytime I run it. It asks for the parameter for
[qryImportFindDuplicatesDE
Thought this was pretty straight forward but I don't get it. Thanks for the help.
What is this qryImportFindDuplicatesDEL ETE ? You need to provide a parameter or a query there to get the IDKey
ASKER
I thank you for the help.
It is a query to find duplicate information in my tables before I append records from Table ImportChildrenPartsCSV into Table SKUs
Query named qryImportFindDuplicatesDEL ETE :
What is this qryImportFindDuplicatesDELETE ?
It is a query to find duplicate information in my tables before I append records from Table ImportChildrenPartsCSV into Table SKUs
Query named qryImportFindDuplicatesDEL
SELECT ImportChildrenPartsCSV.IDKey, ImportChildrenPartsCSV.SkuMPN, ImportChildrenPartsCSV.SkuNm, SKUs.ManuID
FROM SKUs INNER JOIN ImportChildrenPartsCSV ON SKUs.SkuMPN = ImportChildrenPartsCSV.SkuMPN
WHERE (((SKUs.ManuID)=[Forms]![frmImportForm]![txtManuID]));
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok I am sorry but you lost me. I pasted the above code into a query and it is asking for parameter for "K"
I for sure know there are 2 duplicates at this time. How do I run this properly?
If the K is the Key column then wouldn't that be IDKey?
Thanks for the help.
I for sure know there are 2 duplicates at this time. How do I run this properly?
If the K is the Key column then wouldn't that be IDKey?
Thanks for the help.
K was an alias for ImportChildrenPartsCSV ..anyway pls try below-
DELETE FROM ImportChildrenPartsCSV
INNER JOIN
(SELECT ImportChildrenPartsCSV.IDKey
FROM SKUs INNER JOIN ImportChildrenPartsCSV ON SKUs.SkuMPN = ImportChildrenPartsCSV.SkuMPN
WHERE (((SKUs.ManuID)=[Forms]![frmImportForm]![txtManuID]))) as qryImportFindDuplicatesDELETE
ON (ImportChildrenPartsCSV.IDKey) = [qryImportFindDuplicatesDELETE].[IDKey] ;
ASKER
Now it is asking for me to: Specify the table containing the records you want to delete.
Which would be the ImportChildrenPartsCSV Table
Which would be the ImportChildrenPartsCSV Table
How r u executing this ?
Go to the query window and then try.
Go to the query window and then try.
ASKER
I have went to Design then Run and I have saved it and clicked on the query name in the side panel.
Both same results.
Both same results.
NO go to the SQL query window and then execute it using Exclamation mark. (!)
ASKER
I am pretty sure I just got. I examined both the tables and relationships and there was a small flaw in naming.
Pls refer this for SQL View - http://www.jaffainc.com/SQLStatementsInAccess.htm
ASKER
According to that link I am doing it as supposed to. I don't know if this helps but this is my qryImportFindDuplicatesDEL ETE Query:
SQL:
Whatever the issue is it involves this part:
more specifically:
I have thrown several things at it and no matter what it always comes back to asking for a parameter for :
I have tried other tables and queries such as:
SKUs table with known parameters
a newly made table with the data put in directly.
I have just make a select query for testing and it still is failing:
But without the WHERE criteria it SELECTS perfectly:
It can't find any of them........
I have even compacted and repaired the database.
SQL:
SELECT ImportChildrenPartsCSV.SkuMPN, ImportChildrenPartsCSV.SkuNm, SKUs.ManuID, ImportChildrenPartsCSV.IDKey
FROM SKUs INNER JOIN ImportChildrenPartsCSV ON SKUs.SkuMPN = ImportChildrenPartsCSV.SkuMPN
WHERE (((SKUs.ManuID)=[Forms]![frmImportForm]![txtManuID]));
Whatever the issue is it involves this part:
WHERE [ImportChildrenPartsCSV].[skumpn]=[qryImportFindDuplicatesDELETE].[IDKey];
more specifically:
[qryImportFindDuplicatesDELETE].[IDKey];
I have thrown several things at it and no matter what it always comes back to asking for a parameter for :
[qryImportFindDuplicatesDELETE].[IDKey];
I have tried other tables and queries such as:
SKUs table with known parameters
[SKUs].[skumpn];
a newly made table with the data put in directly.
[Table1].[IDKey];
I have just make a select query for testing and it still is failing:
SELECT ImportChildrenPartsCSV.IDKey
FROM ImportChildrenPartsCSV
WHERE (((ImportChildrenPartsCSV.IDKey)=[Table1].[IDKey]))
But without the WHERE criteria it SELECTS perfectly:
SELECT ImportChildrenPartsCSV.IDKey
FROM ImportChildrenPartsCSV
It can't find any of them........
I have even compacted and repaired the database.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
PERFECT! THANKS!
This will delete all the rows from the table..based on matching Ids. * is not required in delete syntax.
Open in new window