H
Helga
My database holds info on fleet. I have a query that retrieves info on each
fleet record from several tables between specified dates entered by the user.
The problem I am having is that some of these tables have multiple records
for each fleet record between the specified dates. I only want the most
recent or last entered records for each fleet from my Registration table.
Any Advise.
Here is the current query:
SELECT tblVehicle.vehFleetIDNum, tblVehicle.vehYear, tblVehicle.vehMake,
tblVehicle.vehModel, tblVehicle.vehLicensePlateNum, tblCity.citName,
tblRegistration.regExpirationDate, tblOwner.ownName, tblLeasedTo.leaName,
tblRegistration.regType
FROM (tblLeasedTo INNER JOIN (tblCity INNER JOIN (tblOwner INNER JOIN
tblVehicle ON (tblOwner.ownIDNum = tblVehicle.vehOwnerID) AND
(tblOwner.ownIDNum = tblVehicle.vehOwnerID)) ON tblCity.citID =
tblVehicle.vehLocation) ON tblLeasedTo.leaID = tblVehicle.vehLeasedTo) INNER
JOIN tblRegistration ON tblVehicle.vehVehicleIDNum =
tblRegistration.regVehicleIDNum
WHERE (((tblRegistration.regExpirationDate) Between [Enter AS OF expiration
date:] And [Enter LATEST desired expiration date:]) AND
((tblVehicle.vehSold)=False));
Thank you.
fleet record from several tables between specified dates entered by the user.
The problem I am having is that some of these tables have multiple records
for each fleet record between the specified dates. I only want the most
recent or last entered records for each fleet from my Registration table.
Any Advise.
Here is the current query:
SELECT tblVehicle.vehFleetIDNum, tblVehicle.vehYear, tblVehicle.vehMake,
tblVehicle.vehModel, tblVehicle.vehLicensePlateNum, tblCity.citName,
tblRegistration.regExpirationDate, tblOwner.ownName, tblLeasedTo.leaName,
tblRegistration.regType
FROM (tblLeasedTo INNER JOIN (tblCity INNER JOIN (tblOwner INNER JOIN
tblVehicle ON (tblOwner.ownIDNum = tblVehicle.vehOwnerID) AND
(tblOwner.ownIDNum = tblVehicle.vehOwnerID)) ON tblCity.citID =
tblVehicle.vehLocation) ON tblLeasedTo.leaID = tblVehicle.vehLeasedTo) INNER
JOIN tblRegistration ON tblVehicle.vehVehicleIDNum =
tblRegistration.regVehicleIDNum
WHERE (((tblRegistration.regExpirationDate) Between [Enter AS OF expiration
date:] And [Enter LATEST desired expiration date:]) AND
((tblVehicle.vehSold)=False));
Thank you.