Please post the SQL statement for this query.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.
- Show quoted text -
It is a big query, TblTempPackingSchedule_Step3 is the local table I
mentioned. I have compact and repaired the database but no luck.
SELECT TblDbMaintenanceADS.DateDelivery,
TblDbMaintenanceADS.PackingSelection,
TblDbMaintenanceADS.DateEstDelivery, TblDbMaintenanceADS.MaintADSType,
TblDbMaintenanceADS.MaintADSRef, TblDbMaintenanceADS.MaintADSRefNo,
TblDbMaintenanceADS.SiteWorkOnly, IIf(IsNull([TblDbMaintenanceADS]!
[DateDelivery]),2,1) AS sort_DateDelivery, IIf([TblDbMaintenanceADS]!
[Pickup]=-1,"Pick Up",IIf([TblDbMaintenanceADS]!
[VehicalType]="Direct","Direct",IIf([TblDbMaintenanceADS]!
[VehicalType]="Crate","Fulton",""))) AS Pickup1,
IIf(IsNull([DateEstDelivery]) Or
IsNull([PackingLeadTime]),Null,Workday([DateEstDelivery],
[PackingLeadTime])) AS InTransit1, IIf(IsNull([TblDbMaintenanceADS]!
[DateDelivery]),2,1) AS Prio1, TblDbMaintenanceADS.PackingDate,
TblDbMaintenanceADS.DateOnSiteComp, TblDbMaintenanceADS.Packed,
TblDbMaintenanceADS.MaintADSType,
TblDbMaintenanceADS.DateOnSiteRequest,
TblSuburbListingsBranch.InransitLeadTime,
TblSuburbListingsBranch.BranchLeadTime,
IIf(IsNull([DateOnSiteRequest]),"N/A",Workday([DateOnSiteRequest],-
[BranchLeadTime])) AS BranchReq, IIf([BranchReq]="N/A","N/
A",Workday([BranchReq],-[InransitLeadTime])) AS ReqTransit,
TblDbMaintenanceADS.MaintADSId, TblDbMaintenanceADS.DateADSMaintComp,
TblSuburbListingsBranch.LocationID,
TblTempPackingSchedule_Step3.Complete,
IIf(IsNull([Complete]),"Complete","") AS Complete1,
TblDBADSFloor.Process AS ManufRespon,
Q_TblCrateIDAvailability.CrateID, TblDbMaintenanceADS.TransitDone,
TblDbMaintenanceADS.InTransit,
TblDbMaintenanceADS.TransittedTimestamp, TblDbMaintenanceADS.Pickup,
TblDbMaintenanceADS.DeliverConf, TblDbMaintenanceADS.BranchRecDone,
Q_TblCrateIDAvailability.DocketPrinted,
TblDbMaintenanceADS.NationalReceiveDone,
TblDbMaintenanceADS.NationalReceiveDate,
TblDbMaintenanceADS.BranchRequestDone,
TblDbMaintenanceADS.BranchRequestDate,
TblDbMaintenanceADS.NationalTransitDone,
TblDbMaintenanceADS.NationalTransitDate,
TblDbMaintenanceADS.TransitDocketNo,
TblDbMaintenanceADS.SelectForTransit, TblDbMaintenanceADS.BanchRec,
InStr([CustCompanyDimension3],"Dist") AS test, TblDBADSFloor.Qty AS
Packages, TblDBADSFloor.PackageConfirmation, TblDBADSFloor.BayNo,
TblDBADSFloor.MaintNumber AS MaintNo, TblDBADSFloor.Process AS
Department, TblDBADSFloor.ADSDone,
IIf(Trim([Location])="Queensland","QLD",IIf(Trim([Location])="Victoria","VIC",IIf(Trim([Location])="Tasmania","TAS",Trim([Location]))))
AS Location1
FROM (((((((tblClaytonsJobData LEFT JOIN TblClaytonsJobsDetails ON
tblClaytonsJobData.JobNumber = TblClaytonsJobsDetails.JobNumber) LEFT
JOIN TblSuburbListingsBranch ON
TblClaytonsJobsDetails.DedicatedLocation =
TblSuburbListingsBranch.LocationID) LEFT JOIN TblDbCustomerCompany ON
tblClaytonsJobData.Customer = TblDbCustomerCompany.CustCompanyName)
RIGHT JOIN TblDBADSFloor ON tblClaytonsJobData.JobNumber =
TblDBADSFloor.JobNumber) LEFT JOIN TblDBADSDPAndFloor ON
TblDBADSFloor.MaintNumber = TblDBADSDPAndFloor.MaintNumber) LEFT JOIN
TblDbMaintenanceADS ON TblDBADSDPAndFloor.MaintADSID =
TblDbMaintenanceADS.MaintADSId) LEFT JOIN TblTempPackingSchedule_Step3
ON TblDbMaintenanceADS.MaintADSId =
TblTempPackingSchedule_Step3.MaintADSId) LEFT JOIN
Q_TblCrateIDAvailability ON TblDbMaintenanceADS.MaintADSId =
Q_TblCrateIDAvailability.MaintNo
WHERE (((TblDbMaintenanceADS.MaintADSType)="E" Or
(TblDbMaintenanceADS.MaintADSType)="F") AND
((TblDbMaintenanceADS.SiteWorkOnly) Is Null Or
(TblDbMaintenanceADS.SiteWorkOnly)=0) AND
((TblDbMaintenanceADS.DateOnSiteComp) Is Null) AND
((TblSuburbListingsBranch.LocationID)<>1) AND
((TblDbMaintenanceADS.TransitDone)=0 Or
(TblDbMaintenanceADS.TransitDone) Is Null) AND
((InStr([CustCompanyDimension3],"Dist"))=0 Or
(InStr([CustCompanyDimension3],"Dist")) Is Null) AND
((TblDBADSFloor.ADSDone)=True)) OR
(((TblDbMaintenanceADS.MaintADSType)="H") AND
((TblDbMaintenanceADS.SiteWorkOnly)=True) AND
((TblDbMaintenanceADS.DateOnSiteComp) Is Null) AND
((TblSuburbListingsBranch.LocationID)<>1) AND
((TblDbMaintenanceADS.TransitDone)=0 Or
(TblDbMaintenanceADS.TransitDone) Is Null) AND
((InStr([CustCompanyDimension3],"Dist"))=0 Or
(InStr([CustCompanyDimension3],"Dist")) Is Null) AND
((TblDBADSFloor.ADSDone)=True))
ORDER BY IIf(IsNull([TblDbMaintenanceADS]![DateDelivery]),2,1),
IIf(Trim([Location])="Queensland","QLD",IIf(Trim([Location])="Victoria","VIC",IIf(Trim([Location])="Tasmania","TAS",Trim([Location])))),
TblDbMaintenanceADS.DateDelivery, TblDbMaintenanceADS.PackingDate;
.