I'm working on a database used for tracking production. Currently, I have a query based off of multiple tables that looks like this:
Product__Date_____Shift___Throughput_Rejects
A...........12/4/06.....1.........1500...........5
A...........12/4/06.....2.........3500...........22
A...........12/4/06.....3.........4000...........29
B...........12/4/06.....3.........500.............8
B...........12/5/06.....1.........2000...........14
As you can see, each shift records the numbers cumulatively. I want to create a query that will tell me what the throughput & rejects (and eventually yield) are for each shift. I already have figured out a way to sort the query correctly so I had anticipated on just saying:
If (CurrentRec.product = PrevRec.product)
Then
ThroughputPerShift = CurrentRec.Throughput - PrevRec.Throughput
Else
ThroughputPerShift = CurrentRec.Throughput
The above is obviously my own syntax. How would I go about doing this in VBA?
Product__Date_____Shift___Throughput_Rejects
A...........12/4/06.....1.........1500...........5
A...........12/4/06.....2.........3500...........22
A...........12/4/06.....3.........4000...........29
B...........12/4/06.....3.........500.............8
B...........12/5/06.....1.........2000...........14
As you can see, each shift records the numbers cumulatively. I want to create a query that will tell me what the throughput & rejects (and eventually yield) are for each shift. I already have figured out a way to sort the query correctly so I had anticipated on just saying:
If (CurrentRec.product = PrevRec.product)
Then
ThroughputPerShift = CurrentRec.Throughput - PrevRec.Throughput
Else
ThroughputPerShift = CurrentRec.Throughput
The above is obviously my own syntax. How would I go about doing this in VBA?