R
rocketD
Hi All,
I have a coworker who summarized his data with a group query by
category, to show the category and the count of records in each
category. He does not need records belonging to a category that has
10 or fewer records in it, so he wants to delete those records from
his table. There are several hundred categories with <10 records, so
going through the table by hand to delete the records is not feasible.
Something I did this morning, where I made a summary query and then
added it to a new query along with the table, allowed me to delete the
records. Then he decided to start over and now what I remember doing
this morning is not longer working. I'm obviously forgetting
something critical.
I tried making the following queries:
qrySummDel:
SELECT validrecords.top_pick_mrkr, Count(validrecords.top_pick_mrkr)
AS [Count]
FROM validrecords
GROUP BY validrecords.top_pick_mrkr
HAVING (((Count(validrecords.top_pick_mrkr))<10));
qryDelete:
DELETE validrecords.*
FROM validrecords INNER JOIN qrySummDel ON validrecords.top_pick_mrkr
= qrySummDel.top_pick_mrkr;
Now, in datasheet view, qryDelete shows all the records from the
validrecords table that have categories matching those selected in
qrySummDel. When I try to delete, I get this error: "Could not
delete from specified tables." I know it has something to do with the
query being linked, but I don't know how else to do this. He wants to
change his criteria, e.g., start with all the categories having <10
records, then <15 records, then <20 (because there are a few certain
categories that fit those criteria that he needs to keep, but he
doesn't know what they are without scanning the data, and there are
70,000 records.).
Can anyone give me suggestions?
I have a coworker who summarized his data with a group query by
category, to show the category and the count of records in each
category. He does not need records belonging to a category that has
10 or fewer records in it, so he wants to delete those records from
his table. There are several hundred categories with <10 records, so
going through the table by hand to delete the records is not feasible.
Something I did this morning, where I made a summary query and then
added it to a new query along with the table, allowed me to delete the
records. Then he decided to start over and now what I remember doing
this morning is not longer working. I'm obviously forgetting
something critical.
I tried making the following queries:
qrySummDel:
SELECT validrecords.top_pick_mrkr, Count(validrecords.top_pick_mrkr)
AS [Count]
FROM validrecords
GROUP BY validrecords.top_pick_mrkr
HAVING (((Count(validrecords.top_pick_mrkr))<10));
qryDelete:
DELETE validrecords.*
FROM validrecords INNER JOIN qrySummDel ON validrecords.top_pick_mrkr
= qrySummDel.top_pick_mrkr;
Now, in datasheet view, qryDelete shows all the records from the
validrecords table that have categories matching those selected in
qrySummDel. When I try to delete, I get this error: "Could not
delete from specified tables." I know it has something to do with the
query being linked, but I don't know how else to do this. He wants to
change his criteria, e.g., start with all the categories having <10
records, then <15 records, then <20 (because there are a few certain
categories that fit those criteria that he needs to keep, but he
doesn't know what they are without scanning the data, and there are
70,000 records.).
Can anyone give me suggestions?