Hello,
We have a locker / lock list. We track who has what lock and locker and the combination.
This is easy, but here's the tricky part: 4 pairs of locks have the same combination, so they would like to keep those locks in separate locker rooms.
The locker list looks like this:
1 - Men's
2 - Men's
3 - Men's
OR
1 - Women's
2 - Women's
3 - Women's
On the employee form there are combo boxes for both locker (LockerCombo) and lock (LockCombo).
I made this query which gets any lock that has another lock with the same combination:
qry_LocksDulicates
then this query for the actual list of available locks that will show up in [LockCombo].
qry_AvailableLocks
The query above designates either an M or W depending on what locker that person is assigned, compares locks with their duplicates, and removes from the list any lock with the same combo that is already in that locker room.
It works fine - but it's very slow. About 15 seconds from the time you click on the combo box to the time the list populates.
Any suggestions on how I can speed this up? I think I must be taking too many steps to do something simple.
We have a locker / lock list. We track who has what lock and locker and the combination.
This is easy, but here's the tricky part: 4 pairs of locks have the same combination, so they would like to keep those locks in separate locker rooms.
The locker list looks like this:
1 - Men's
2 - Men's
3 - Men's
OR
1 - Women's
2 - Women's
3 - Women's
On the employee form there are combo boxes for both locker (LockerCombo) and lock (LockCombo).
I made this query which gets any lock that has another lock with the same combination:
qry_LocksDulicates
Code:
SELECT tbl_Locks.Combination, tbl_Locks.LockNumber, tbl_Locks.LockSerial, qry_AllLocksAndLockers.LockerNumber
FROM tbl_Locks LEFT JOIN qry_AllLocksAndLockers ON tbl_Locks.LockNumber = qry_AllLocksAndLockers.LockNumber
WHERE (((tbl_Locks.Combination) In (SELECT [Combination] FROM [tbl_Locks] As Tmp GROUP BY [Combination] HAVING Count(*)>1 )))
ORDER BY tbl_Locks.Combination;
qry_AvailableLocks
Code:
SELECT tbl_Locks.LockNumber, tbl_Locks.Combination, DLookUp("[LockerNumber]","[qry_LocksDuplicates]","[LockNumber] <> " & [tbl_Locks].[LockNumber] & " And [Combination] = " & [tbl_Locks].[Combination]) AS DuplicateLock, IIf([Forms]![frm_Employees]![LockerCombo] Like "*Women's*","W","M") AS AssignedLocker
FROM tbl_Locks LEFT JOIN qry_AllLocksAndLockers ON tbl_Locks.LockNumber = qry_AllLocksAndLockers.LockNumber
WHERE (((qry_AllLocksAndLockers.EmployeeName) Is Null));
It works fine - but it's very slow. About 15 seconds from the time you click on the combo box to the time the list populates.
Any suggestions on how I can speed this up? I think I must be taking too many steps to do something simple.