Rik_StHelens
Registered User.
- Local time
- Today, 07:24
- Joined
- Sep 15, 2009
- Messages
- 164
Hi,
I have a query which outputs to a report.
It takes a full set of customer vehicles, groups them by fleet location and count the total costs incurred by that fleet for repairs/inspections etc. The report then works out the average cost per vehicle, by fleet.
In the report i do a count function which counts the number of reg's in a grouping to work out the number of vehicles per fleet. However, if a vehicle has incurred more than one cost in the specified time period, it counts it more than once because it pulls more than one record for that vehicle.
Is there any way i can stop it from doing this at report level, or is it at query level?
Here is the query spl:
SELECT tblVehicle.Customer, TRNLIST.TNETT, tblVehicle.FleetName, tblVehicle.RegistrationNumber
FROM tblVehicle INNER JOIN (tblInspection LEFT JOIN TRNLIST ON tblInspection.JobSheetNumber = TRNLIST.OLDADVNUM) ON tblVehicle.RegistrationNumber = tblInspection.Registration
WHERE (((tblVehicle.Customer) Like "*" & [Customer Name] & "*") AND ((tblInspection.InspectionDate)>=[Date From (dd/mm/yyyy)]));
Thanks for your time.
I have a query which outputs to a report.
It takes a full set of customer vehicles, groups them by fleet location and count the total costs incurred by that fleet for repairs/inspections etc. The report then works out the average cost per vehicle, by fleet.
In the report i do a count function which counts the number of reg's in a grouping to work out the number of vehicles per fleet. However, if a vehicle has incurred more than one cost in the specified time period, it counts it more than once because it pulls more than one record for that vehicle.
Is there any way i can stop it from doing this at report level, or is it at query level?
Here is the query spl:
SELECT tblVehicle.Customer, TRNLIST.TNETT, tblVehicle.FleetName, tblVehicle.RegistrationNumber
FROM tblVehicle INNER JOIN (tblInspection LEFT JOIN TRNLIST ON tblInspection.JobSheetNumber = TRNLIST.OLDADVNUM) ON tblVehicle.RegistrationNumber = tblInspection.Registration
WHERE (((tblVehicle.Customer) Like "*" & [Customer Name] & "*") AND ((tblInspection.InspectionDate)>=[Date From (dd/mm/yyyy)]));
Thanks for your time.