Long time listener, first time caller. 
I have a database that is split into two files. Let's call them:
One table (CycleCounts) has a field "PickLoc," which is a product's picking location, and is scraped from another source. The first three digits of this PickLoc are the bin number, followed by shelf number, then lane#.
We have to inventory these products one bin at a time, and I need to be sure that all of the SKUs in a bin have been counted before going to the next bin. So, essentially, if we count anything from a bin, we must count *everything* in that bin.
These counts are in a separate table (ShelfCounts) with a many-to-one relationship.
In order to check for missing products, I had to do a query first to get which bins were done on which date (this query is called "BayByDate"):
Then to check for missing products, I have this query (called "MissingProds"):
Essentially, if the bin number of the product is in the BayByDate report, but the CC_ID isn't in the ShelfCount table, select it.
The problem is that this query takes forever, sometimes a half hour or more, and this is only going to get worse as more and more records get added to the CycleCounts and ShelfCounts tables. Any ideas on how to speed this up?
Any help is appreciated.

I have a database that is split into two files. Let's call them:
- MyDatabase.accdb
- MyDatabase_be.accdb
One table (CycleCounts) has a field "PickLoc," which is a product's picking location, and is scraped from another source. The first three digits of this PickLoc are the bin number, followed by shelf number, then lane#.
We have to inventory these products one bin at a time, and I need to be sure that all of the SKUs in a bin have been counted before going to the next bin. So, essentially, if we count anything from a bin, we must count *everything* in that bin.
These counts are in a separate table (ShelfCounts) with a many-to-one relationship.
In order to check for missing products, I had to do a query first to get which bins were done on which date (this query is called "BayByDate"):
Code:
PARAMETERS vrDate DateTime;
SELECT DISTINCT CycleCounts.CC_Date, Left ([CycleCounts].[PickLoc],3) AS Bin
FROM CycleCounts INNER JOIN ShelfCounts ON CycleCounts.CC_ID=ShelfCounts.CC_ID
WHERE CycleCounts.CC_Date=[vrDate];
Then to check for missing products, I have this query (called "MissingProds"):
Code:
PARAMETERS vrDate DateTime;
SELECT CycleCounts.SKU, CycleCounts.PickLoc, CycleCounts.CC_Date
FROM CycleCounts
WHERE (((Left([CycleCounts].[PickLoc],3)) In
(Select [BayByDate].[Bin] FROM [BayByDate];))
AND ((CycleCounts.CC_ID) Not In
(SELECT CC_ID FROM [ShelfCounts];)))
GROUP BY CycleCounts.SKU, CycleCounts.PickLoc, CycleCounts.CC_Date
HAVING (((CycleCounts.CC_Date)=[vrDate]))
ORDER BY CycleCounts.CC_1stAFFLOW;
Essentially, if the bin number of the product is in the BayByDate report, but the CC_ID isn't in the ShelfCount table, select it.
The problem is that this query takes forever, sometimes a half hour or more, and this is only going to get worse as more and more records get added to the CycleCounts and ShelfCounts tables. Any ideas on how to speed this up?
Any help is appreciated.