Been working on this for a bit...I think I know how I would do this in code but I really need to accomplish it in a query because I need to use the results in several other queries.
In simple terms (left out unnecessary fields etc), I have a shift table and a another table with a one to many relationship that captures products that were worked on in that shift.
tblShifts
ShiftID (pk)
ShiftDate
ShiftName
tblShiftProduction
ShiftProductionID (pk)
ShiftID (fk)
ProductID (fk)
Then there is an inventory table that captures counts done each shift
I have to do an inventory calculation but first, I have to check if the same product was counted in the previous shift because if it was, the calculation is different than if it wasn't.
Say ProductID = 1 and the ShiftID I'm working on is 20, I need to find out if there is a record matching ProductID 1 in shift 19.
I tried to construct a query using DLOOKUP in an expression using ShiftID-1 as the criteria argument but couldn't make it work.
I've been working on this awhile and the resolution isn't coming to me. Any ideas?
In simple terms (left out unnecessary fields etc), I have a shift table and a another table with a one to many relationship that captures products that were worked on in that shift.
tblShifts
ShiftID (pk)
ShiftDate
ShiftName
tblShiftProduction
ShiftProductionID (pk)
ShiftID (fk)
ProductID (fk)
Then there is an inventory table that captures counts done each shift
I have to do an inventory calculation but first, I have to check if the same product was counted in the previous shift because if it was, the calculation is different than if it wasn't.
Say ProductID = 1 and the ShiftID I'm working on is 20, I need to find out if there is a record matching ProductID 1 in shift 19.
I tried to construct a query using DLOOKUP in an expression using ShiftID-1 as the criteria argument but couldn't make it work.
I've been working on this awhile and the resolution isn't coming to me. Any ideas?