Rik_StHelens
Registered User.
- Local time
- Today, 22:34
- Joined
- Sep 15, 2009
- Messages
- 164
I have a report which calculates the value of the tyre rubber remaining on a vehicle.
The report is based on the following query:
SELECT qryEfficiencyUnbound.[Vehicle Reg], qryEfficiencyUnbound.Tyre, qryEfficiencyUnbound.Pattern, qryEfficiencyUnbound.OTD, qryEfficiencyUnbound.RTD, qryEfficiencyUnbound.Cost, qryEfficiencyUnbound.[Price Per Mil], Sum([tblTyres].[cost])/Sum([otd])*Sum([rtd]) AS [Remaining Value]
FROM tblTyres INNER JOIN qryEfficiencyUnbound ON tblTyres.Pattern = qryEfficiencyUnbound.Pattern
GROUP BY qryEfficiencyUnbound.[Vehicle Reg], qryEfficiencyUnbound.Tyre, qryEfficiencyUnbound.Pattern, qryEfficiencyUnbound.OTD, qryEfficiencyUnbound.RTD, qryEfficiencyUnbound.Cost, qryEfficiencyUnbound.[Price Per Mil];
When I added the Sum([tblTyres].[cost])/Sum([otd])*Sum([rtd]) AS [Remaining Value] line to the SQL, this caused the report to stop displaying identical lines of data.
For example, two tyres fitted at the same time that are the same make/size/pattern/cost have worn equally over time, giving them the same [remaining value]. The report will only display one of the tyres, which then throws out my calculation across the whole vehicle/fleet/depot etc.
Any ideas whats happening here?
Thanks for your time!
The report is based on the following query:
SELECT qryEfficiencyUnbound.[Vehicle Reg], qryEfficiencyUnbound.Tyre, qryEfficiencyUnbound.Pattern, qryEfficiencyUnbound.OTD, qryEfficiencyUnbound.RTD, qryEfficiencyUnbound.Cost, qryEfficiencyUnbound.[Price Per Mil], Sum([tblTyres].[cost])/Sum([otd])*Sum([rtd]) AS [Remaining Value]
FROM tblTyres INNER JOIN qryEfficiencyUnbound ON tblTyres.Pattern = qryEfficiencyUnbound.Pattern
GROUP BY qryEfficiencyUnbound.[Vehicle Reg], qryEfficiencyUnbound.Tyre, qryEfficiencyUnbound.Pattern, qryEfficiencyUnbound.OTD, qryEfficiencyUnbound.RTD, qryEfficiencyUnbound.Cost, qryEfficiencyUnbound.[Price Per Mil];
When I added the Sum([tblTyres].[cost])/Sum([otd])*Sum([rtd]) AS [Remaining Value] line to the SQL, this caused the report to stop displaying identical lines of data.
For example, two tyres fitted at the same time that are the same make/size/pattern/cost have worn equally over time, giving them the same [remaining value]. The report will only display one of the tyres, which then throws out my calculation across the whole vehicle/fleet/depot etc.
Any ideas whats happening here?
Thanks for your time!