Windows XP SP3, Access 2010 in 2007 mode.
I need to set the record source for a summary report on open. I have the detail query and and the summary query set up as queries but I need to set them up dyanamically on form open to specify the Plant Code and Model Year. The summary query uses the detail query and I can't figure out how to do that in VBA.
Detail Query:
SELECT tblPartRouteAssignment.Route, tblPartRouteAssignment.PartNumber, tblPartRouteAssignment.Station, tblPartRouteAssignment.LineFeedDeliveryType, tblPartRouteAssignment.ReceivingDock, tblPartRouteAssignment.LocFullStorage, tblPartRouteAssignment.LocLineFeedStaging, tblPartRouteAssignment.LocEmptyStorage, tblPartRouteAssignment.LocDockReturn, tblPartInfo.Description, IIf([StationBld_Rate]=0,[VerifiedBld_Rate],[StationBld_Rate]) AS Bld_Rate, tblPartInfo.PackDensity, tblPartInfo.Container, tblPartInfo.Length, tblPartInfo.Width, tblPartInfo.Height, [Bld_Rate]/[PackDensity] AS COPD, tblLinefeedHandling.LineFeedHandling, tblLinefeedHandling.StagingHandling, tblLinefeedHandling.EmptyReturnHandling, tblPartRouteAssignment.StackHtReceiving, tblPartRouteAssignment.StackHtLFDelivery, (([LineFeedHandling]/[StackHtLFDelivery])+([StagingHandling]/[StackHtReceiving])+([EmptyReturnHandling]/[StackHtReceiving])) AS HdlgPerCont, tblPartRouteAssignment.TravDistLineFeed, tblPartRouteAssignment.TravDistStaging, tblPartRouteAssignment.TravDistDock, tblPartRouteAssignment.TravDistEmpty, (([TravDistLineFeed]/[StackHtLFDelivery])+([TravDistStaging]/[StackHtReceiving])+([TravDistEmpty]/[StackHtReceiving])) AS TravelPerTrip, [TravelPerTrip]*0.00227 AS TravelMinPerTrip, [HdlgPerCont]+[TravelMinPerTrip] AS AllocPerCont, [AllocPerCont]*[COPD] AS LFAllocation, tblPlantInfo.WorkingMinPerShift, tblPartRouteAssignment.PlantCode, tblPartRouteAssignment.ModelYear
FROM (((tblPartRouteAssignment INNER JOIN tblPlantInfo ON tblPartRouteAssignment.PlantCode = tblPlantInfo.PlantCode) INNER JOIN tblPartStation ON (tblPartRouteAssignment.PlantCode = tblPartStation.PlantCode) AND (tblPartRouteAssignment.PartNumber = tblPartStation.PartNumber) AND (tblPartRouteAssignment.Station = tblPartStation.Station)) INNER JOIN tblLinefeedHandling ON tblPartRouteAssignment.LineFeedDeliveryType = tblLinefeedHandling.LineFeedType) INNER JOIN tblPartInfo ON (tblPartRouteAssignment.PlantCode = tblPartInfo.PlantCode) AND (tblPartRouteAssignment.PartNumber = tblPartInfo.PartNumber)
WHERE (((tblPartRouteAssignment.PlantCode)="02452") AND ((tblPartRouteAssignment.ModelYear)="2010"));
Summary Query:
SELECT tblRouteInfo.Route, tblRouteInfo.Department, tblRouteInfo.ModelType, tblRouteInfo.JobType, tblRouteInfo.Validated, tblRouteInfo.NumberofDrivers, tblRouteInfo.AddlMinPerShift, Sum(qryRouteEfficiencyDetail.LFAllocation) AS SumOfLFAllocation
FROM tblRouteInfo INNER JOIN qryRouteEfficiencyDetail ON (tblRouteInfo.Route = qryRouteEfficiencyDetail.Route) AND (tblRouteInfo.PlantCode = qryRouteEfficiencyDetail.PlantCode)
GROUP BY tblRouteInfo.Route, tblRouteInfo.Department, tblRouteInfo.ModelType, tblRouteInfo.JobType, tblRouteInfo.Validated, tblRouteInfo.NumberofDrivers, tblRouteInfo.AddlMinPerShift;
Am I missing the obvious? Probably!
Thanks for any help,
Joel
Joel
I need to set the record source for a summary report on open. I have the detail query and and the summary query set up as queries but I need to set them up dyanamically on form open to specify the Plant Code and Model Year. The summary query uses the detail query and I can't figure out how to do that in VBA.
Detail Query:
SELECT tblPartRouteAssignment.Route, tblPartRouteAssignment.PartNumber, tblPartRouteAssignment.Station, tblPartRouteAssignment.LineFeedDeliveryType, tblPartRouteAssignment.ReceivingDock, tblPartRouteAssignment.LocFullStorage, tblPartRouteAssignment.LocLineFeedStaging, tblPartRouteAssignment.LocEmptyStorage, tblPartRouteAssignment.LocDockReturn, tblPartInfo.Description, IIf([StationBld_Rate]=0,[VerifiedBld_Rate],[StationBld_Rate]) AS Bld_Rate, tblPartInfo.PackDensity, tblPartInfo.Container, tblPartInfo.Length, tblPartInfo.Width, tblPartInfo.Height, [Bld_Rate]/[PackDensity] AS COPD, tblLinefeedHandling.LineFeedHandling, tblLinefeedHandling.StagingHandling, tblLinefeedHandling.EmptyReturnHandling, tblPartRouteAssignment.StackHtReceiving, tblPartRouteAssignment.StackHtLFDelivery, (([LineFeedHandling]/[StackHtLFDelivery])+([StagingHandling]/[StackHtReceiving])+([EmptyReturnHandling]/[StackHtReceiving])) AS HdlgPerCont, tblPartRouteAssignment.TravDistLineFeed, tblPartRouteAssignment.TravDistStaging, tblPartRouteAssignment.TravDistDock, tblPartRouteAssignment.TravDistEmpty, (([TravDistLineFeed]/[StackHtLFDelivery])+([TravDistStaging]/[StackHtReceiving])+([TravDistEmpty]/[StackHtReceiving])) AS TravelPerTrip, [TravelPerTrip]*0.00227 AS TravelMinPerTrip, [HdlgPerCont]+[TravelMinPerTrip] AS AllocPerCont, [AllocPerCont]*[COPD] AS LFAllocation, tblPlantInfo.WorkingMinPerShift, tblPartRouteAssignment.PlantCode, tblPartRouteAssignment.ModelYear
FROM (((tblPartRouteAssignment INNER JOIN tblPlantInfo ON tblPartRouteAssignment.PlantCode = tblPlantInfo.PlantCode) INNER JOIN tblPartStation ON (tblPartRouteAssignment.PlantCode = tblPartStation.PlantCode) AND (tblPartRouteAssignment.PartNumber = tblPartStation.PartNumber) AND (tblPartRouteAssignment.Station = tblPartStation.Station)) INNER JOIN tblLinefeedHandling ON tblPartRouteAssignment.LineFeedDeliveryType = tblLinefeedHandling.LineFeedType) INNER JOIN tblPartInfo ON (tblPartRouteAssignment.PlantCode = tblPartInfo.PlantCode) AND (tblPartRouteAssignment.PartNumber = tblPartInfo.PartNumber)
WHERE (((tblPartRouteAssignment.PlantCode)="02452") AND ((tblPartRouteAssignment.ModelYear)="2010"));
Summary Query:
SELECT tblRouteInfo.Route, tblRouteInfo.Department, tblRouteInfo.ModelType, tblRouteInfo.JobType, tblRouteInfo.Validated, tblRouteInfo.NumberofDrivers, tblRouteInfo.AddlMinPerShift, Sum(qryRouteEfficiencyDetail.LFAllocation) AS SumOfLFAllocation
FROM tblRouteInfo INNER JOIN qryRouteEfficiencyDetail ON (tblRouteInfo.Route = qryRouteEfficiencyDetail.Route) AND (tblRouteInfo.PlantCode = qryRouteEfficiencyDetail.PlantCode)
GROUP BY tblRouteInfo.Route, tblRouteInfo.Department, tblRouteInfo.ModelType, tblRouteInfo.JobType, tblRouteInfo.Validated, tblRouteInfo.NumberofDrivers, tblRouteInfo.AddlMinPerShift;
Am I missing the obvious? Probably!
Thanks for any help,
Joel
Joel