You didn't describe the table(s) structure(s).
And it would help to see some data and expected results.
Maybe:
If the table names are
tblLocks: fields Locks, SN
tblKeys: fields Keys, SN
qryLockCount: a totals query counting locks, grouped by serial number
Code:
SELECT Count(tblLocks.Locks) AS CountOfLocks, tblLocks.SN
FROM tblLocks
GROUP BY tblLocks.SN;
qryKeysCount: a totals query counting keys, grouped by serial number
Code:
SELECT Count(tblKeys.Keys) AS CountOfKeys, tblKeys.SN
FROM tblKeys
GROUP BY tblKeys.SN;
qryKeysLocks: another query based on the first 2 queries
Code:
SELECT qryKeysCount.CountOfKeys, qryLockCount.CountOfLocks, qryKeysCount.SN
FROM qryKeysCount INNER JOIN qryLockCount ON qryKeysCount.SN = qryLockCount.SN;
Final query:
Code:
SELECT qryKeysLocks.SN, qryKeysLocks.CountOfLocks, qryKeysLocks.CountOfKeys
FROM qryKeysLocks
WHERE (((qryKeysLocks.CountOfLocks)=[Forms]![FormName].[tbLocks]) AND ((qryKeysLocks.CountOfKeys)=[Forms]![FormName].[tbKeys]));
"tbLocks" = the unbound control on form for the number of locks ("tb" = Text box)
Change "FormName" and the unbound text box control names to your names.