V
vbnetman via AccessMonster.com
I need to create a listbox that displays the history of meters (odometer,
hourmeter etc) for equipment. This will need to be based on a query, a topic
that is my greatest weakness and I am requesting assistance. I have the
following table / field arrangement; (for simplicity some fields have been
omitted).
tbl_runningMeter
<<unit of measure>>
tbl_meterReading
<<unitID>>
<<meterID>>
<<replacementNumber>>
<<readDate>>
<<meterRead>>
Here’s a bit of info about the arrangement:
UnitOfMeasure - defines the type of meter (hour meter or odometer)
The meter reading table looks something like this:
unitID meterID meterRead replacementNumber readDate replace
1 1 10 0
10/1/06
1 1 15 0
10/3/06
1 1 20 0
10/4/06 x
1 1 7 1
10/5/06
1 1 35 1
10/6/06
1) Note that unit#1, meter#1 replacement#0 is a replaced meter and unit#1,
meter#1, replacement#0 is the current meter, not to be included in the
listbox.
2)The db can have more than one unit and more than one meter per unit.
3) Although the unit itself has a total reading of 38, the per meter
breakdown is as follows and here’s what I need for the end result;
unitOfMeasure unitID meterID startRead endRead totalRun replaceDate
miles 1 1 10 20
10 10/4/06
The date 10/1/06 is the start date of meter1. (assume in this case that the
meter was purchased from the factory with “10†on it. The date in this
example of 10/4/06 represents the date of the last and final reading of the
meter before it’s replaced, thus a total read for the original meter is 10.
10/5/06 is the date of the first reading for its replacement.
Could someone give me an assist with the SQL?
Thank you in advance
hourmeter etc) for equipment. This will need to be based on a query, a topic
that is my greatest weakness and I am requesting assistance. I have the
following table / field arrangement; (for simplicity some fields have been
omitted).
tbl_runningMeter
<<unit of measure>>
tbl_meterReading
<<unitID>>
<<meterID>>
<<replacementNumber>>
<<readDate>>
<<meterRead>>
Here’s a bit of info about the arrangement:
UnitOfMeasure - defines the type of meter (hour meter or odometer)
The meter reading table looks something like this:
unitID meterID meterRead replacementNumber readDate replace
1 1 10 0
10/1/06
1 1 15 0
10/3/06
1 1 20 0
10/4/06 x
1 1 7 1
10/5/06
1 1 35 1
10/6/06
1) Note that unit#1, meter#1 replacement#0 is a replaced meter and unit#1,
meter#1, replacement#0 is the current meter, not to be included in the
listbox.
2)The db can have more than one unit and more than one meter per unit.
3) Although the unit itself has a total reading of 38, the per meter
breakdown is as follows and here’s what I need for the end result;
unitOfMeasure unitID meterID startRead endRead totalRun replaceDate
miles 1 1 10 20
10 10/4/06
The date 10/1/06 is the start date of meter1. (assume in this case that the
meter was purchased from the factory with “10†on it. The date in this
example of 10/4/06 represents the date of the last and final reading of the
meter before it’s replaced, thus a total read for the original meter is 10.
10/5/06 is the date of the first reading for its replacement.
Could someone give me an assist with the SQL?
Thank you in advance