The worst query I ever had to write which powers a master report for the database user.  Here it is.  I don’t think I can make it smaller, there were too many weird rules, aggregates, and translations in it.  And we needed to pull different columns based on criteria.  And it is a Union Query.  This one makes me tired just reading it.  But it is an excellent example of many different skills in one powerful query….sum, iif, group by, inner join, format, and more.  Skilllevel required is Access Demi-God:

SELECT tblPolicyItems.CropID, tblPolicyItems.PolicyItemNumber, Sum(tblClaimItemCounts.acresCounted) AS SumOfacresCounted, tblPolicyItems.ActualAcres, tblClaimItems.TypeOfCrop, tblPolicyItems.Quarter, tblPolicyItems.Section, tblPolicyItems.Township, tblPolicyItems.Range, tblPolicyItems.Meridian, tblClaimItems.ClaimNumber, tblClaims.ClaimID, tblClaimItems.ClaimItemID, tblClaims.PolicyID, tblClaimItems.PolicyItemID, tblPolicies.PolicyNum, tblClaimItems.Pickup, tblClaimItems.MatchTotalLoss, tblPolicyItems.InsurancePerAcre, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),[tblclaimitems].[status],IIf([matchtotalloss]>0,[matchtotalloss],(IIf([columnt]<5,” < 5%”,IIf([columnt]>=90,”100%”,Format([TBLCLAIMITEMS].[AgreedLoss],”#,##0.0″)))))) AS FinalTotal, qryPriorLoss.FinalTotal AS FinalTotalPrior, qryPriorLoss.SumOfAgreedThisLoss, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),”NO”,IIf([matchtotalloss]>0,”NO”,(IIf([columnt]<5,”YES”,IIf([columnt]>=90,”YES”,”NO”))))) AS Split, tblClaimItems.Pickup, tblClaimItems.Nonwaivered, tblClaimItems.Claimed
FROM (((tblPolicies INNER JOIN tblClaims ON tblPolicies.PolicyID = tblClaims.PolicyID) INNER JOIN tblPolicyItems ON tblPolicies.PolicyID = tblPolicyItems.PolicyID) INNER JOIN (tblClaimItems LEFT JOIN tblClaimItemCounts ON tblClaimItems.ClaimItemID = tblClaimItemCounts.ClaimItemID) ON tblPolicyItems.PolicyItemID = tblClaimItems.PolicyItemID) LEFT JOIN qryPriorLoss ON tblPolicyItems.PolicyItemID = qryPriorLoss.PolicyItemNumber
GROUP BY tblPolicyItems.CropID, tblPolicyItems.PolicyItemNumber, tblPolicyItems.ActualAcres, tblClaimItems.TypeOfCrop, tblPolicyItems.Quarter, tblPolicyItems.Section, tblPolicyItems.Township, tblPolicyItems.Range, tblPolicyItems.Meridian, tblClaimItems.ClaimNumber, tblClaims.ClaimID, tblClaimItems.ClaimItemID, tblClaims.PolicyID, tblClaimItems.PolicyItemID, tblPolicies.PolicyNum, tblClaimItems.MatchTotalLoss, tblPolicyItems.InsurancePerAcre, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),[tblclaimitems].[status],IIf([matchtotalloss]>0,[matchtotalloss],(IIf([columnt]<5,” < 5%”,IIf([columnt]>=90,”100%”,Format([TBLCLAIMITEMS].[AgreedLoss],”#,##0.0″)))))), qryPriorLoss.FinalTotal, qryPriorLoss.SumOfAgreedThisLoss, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),”NO”,IIf([matchtotalloss]>0,”NO”,(IIf([columnt]<5,”YES”,IIf([columnt]>=90,”YES”,”NO”))))), tblClaimItems.Pickup, tblClaimItems.Nonwaivered, tblClaimItems.Claimed, tblClaimItems.Pickup
HAVING (((tblPolicyItems.CropID)=1 Or (tblPolicyItems.CropID)=5) AND ((tblClaims.ClaimID)=[tempvars]![tmpclaimid]) AND ((tblClaimItems.Pickup)=True)) OR (((tblPolicyItems.CropID)=1 Or (tblPolicyItems.CropID)=5) AND ((tblClaims.ClaimID)=[tempvars]![tmpclaimid]) AND ((tblClaimItems.Claimed)=True))
union
SELECT tblPolicyItems.CropID, tblPolicyItems.PolicyItemNumber, Sum(tblClaimItemCounts.acresCounted) AS SumOfacresCounted, tblPolicyItems.ActualAcres, tblClaimItems.TypeOfCrop, tblPolicyItems.Quarter, tblPolicyItems.Section, tblPolicyItems.Township, tblPolicyItems.Range, tblPolicyItems.Meridian, tblClaimItems.ClaimNumber, tblClaims.ClaimID, tblClaimItems.ClaimItemID, tblClaims.PolicyID, tblClaimItems.PolicyItemID, tblPolicies.PolicyNum, tblClaimItems.Pickup, tblClaimItems.MatchTotalLoss, tblPolicyItems.InsurancePerAcre, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),[tblclaimitems].[status],IIf([matchtotalloss]>0,[matchtotalloss],(IIf([COLUMNH]<5,” < 5%”,IIf([COLUMNH]>=90,”100%”,Format([TBLCLAIMITEMS].[AgreedLoss],”#,##0.0″)))))) AS FinalTotal, qryPriorLoss.FinalTotal AS FinalTotalPrior, qryPriorLoss.SumOfAgreedThisLoss, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),”NO”,IIf([matchtotalloss]>0,”NO”,(IIf([COLUMNH]<5,”YES”,IIf([COLUMNH]>=90,”YES”,”NO”))))) AS Split, tblClaimItems.Pickup, tblClaimItems.Nonwaivered, tblClaimItems.Claimed
FROM (((tblPolicies INNER JOIN tblClaims ON tblPolicies.PolicyID = tblClaims.PolicyID) INNER JOIN tblPolicyItems ON tblPolicies.PolicyID = tblPolicyItems.PolicyID) INNER JOIN (tblClaimItems LEFT JOIN tblClaimItemCounts ON tblClaimItems.ClaimItemID = tblClaimItemCounts.ClaimItemID) ON tblPolicyItems.PolicyItemID = tblClaimItems.PolicyItemID) LEFT JOIN qryPriorLoss ON tblPolicyItems.PolicyItemID = qryPriorLoss.PolicyItemNumber
GROUP BY tblPolicyItems.CropID, tblPolicyItems.PolicyItemNumber, tblPolicyItems.ActualAcres, tblClaimItems.TypeOfCrop, tblPolicyItems.Quarter, tblPolicyItems.Section, tblPolicyItems.Township, tblPolicyItems.Range, tblPolicyItems.Meridian, tblClaimItems.ClaimNumber, tblClaims.ClaimID, tblClaimItems.ClaimItemID, tblClaims.PolicyID, tblClaimItems.PolicyItemID, tblPolicies.PolicyNum, tblClaimItems.MatchTotalLoss, tblPolicyItems.InsurancePerAcre, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),[tblclaimitems].[status],IIf([matchtotalloss]>0,[matchtotalloss],(IIf([COLUMNH]<5,” < 5%”,IIf([COLUMNH]>=90,”100%”,Format([TBLCLAIMITEMS].[AgreedLoss],”#,##0.0″)))))), qryPriorLoss.FinalTotal, qryPriorLoss.SumOfAgreedThisLoss, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),”NO”,IIf([matchtotalloss]>0,”NO”,(IIf([COLUMNH]<5,”YES”,IIf([COLUMNH]>=90,”YES”,”NO”))))), tblClaimItems.Pickup, tblClaimItems.Nonwaivered, tblClaimItems.Claimed, tblClaimItems.Pickup
HAVING (((tblPolicyItems.CropID)=2 Or (tblPolicyItems.CropID)=6 Or (tblPolicyItems.CropID)=7 Or (tblPolicyItems.CropID)=8 Or (tblPolicyItems.CropID)=9 Or (tblPolicyItems.CropID)=10 Or (tblPolicyItems.CropID)=11 Or (tblPolicyItems.CropID)=12 Or (tblPolicyItems.CropID)=61 Or (tblPolicyItems.CropID)=76 Or (tblPolicyItems.CropID)=63) AND ((tblClaims.ClaimID)=[tempvars]![tmpclaimid]) AND ((tblClaimItems.Pickup)=True)) OR (((tblPolicyItems.CropID)=2 Or (tblPolicyItems.CropID)=6 Or (tblPolicyItems.CropID)=7 Or (tblPolicyItems.CropID)=8 Or (tblPolicyItems.CropID)=9 Or (tblPolicyItems.CropID)=10 Or (tblPolicyItems.CropID)=11 Or (tblPolicyItems.CropID)=12 Or (tblPolicyItems.CropID)=61 Or (tblPolicyItems.CropID)=76 Or (tblPolicyItems.CropID)=63) AND ((tblClaims.ClaimID)=[tempvars]![tmpclaimid]) AND ((tblClaimItems.Claimed)=True))
UNION
SELECT tblPolicyItems.CropID, tblPolicyItems.PolicyItemNumber, Sum(tblClaimItemCounts.acresCounted) AS SumOfacresCounted, tblPolicyItems.ActualAcres, tblClaimItems.TypeOfCrop, tblPolicyItems.Quarter, tblPolicyItems.Section, tblPolicyItems.Township, tblPolicyItems.Range, tblPolicyItems.Meridian, tblClaimItems.ClaimNumber, tblClaims.ClaimID, tblClaimItems.ClaimItemID, tblClaims.PolicyID, tblClaimItems.PolicyItemID, tblPolicies.PolicyNum, tblClaimItems.Pickup, tblClaimItems.MatchTotalLoss, tblPolicyItems.InsurancePerAcre, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),[tblclaimitems].[status],IIf([matchtotalloss]>0,[matchtotalloss],(IIf([COLUMNL]<5,” < 5%”,IIf([COLUMNL]>=90,”100%”,Format([TBLCLAIMITEMS].[AgreedLoss],”#,##0.0″)))))) AS FinalTotal, qryPriorLoss.FinalTotal AS FinalTotalPrior, qryPriorLoss.SumOfAgreedThisLoss, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),”NO”,IIf([matchtotalloss]>0,”NO”,(IIf([COLUMNL]<5,”YES”,IIf([COLUMNL]>=90,”YES”,”NO”))))) AS Split, tblClaimItems.Pickup, tblClaimItems.Nonwaivered, tblClaimItems.Claimed
FROM (((tblPolicies INNER JOIN tblClaims ON tblPolicies.PolicyID = tblClaims.PolicyID) INNER JOIN tblPolicyItems ON tblPolicies.PolicyID = tblPolicyItems.PolicyID) INNER JOIN (tblClaimItems LEFT JOIN tblClaimItemCounts ON tblClaimItems.ClaimItemID = tblClaimItemCounts.ClaimItemID) ON tblPolicyItems.PolicyItemID = tblClaimItems.PolicyItemID) LEFT JOIN qryPriorLoss ON tblPolicyItems.PolicyItemID = qryPriorLoss.PolicyItemNumber
GROUP BY tblPolicyItems.CropID, tblPolicyItems.PolicyItemNumber, tblPolicyItems.ActualAcres, tblClaimItems.TypeOfCrop, tblPolicyItems.Quarter, tblPolicyItems.Section, tblPolicyItems.Township, tblPolicyItems.Range, tblPolicyItems.Meridian, tblClaimItems.ClaimNumber, tblClaims.ClaimID, tblClaimItems.ClaimItemID, tblClaims.PolicyID, tblClaimItems.PolicyItemID, tblPolicies.PolicyNum, tblClaimItems.MatchTotalLoss, tblPolicyItems.InsurancePerAcre, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),[tblclaimitems].[status],IIf([matchtotalloss]>0,[matchtotalloss],(IIf([COLUMNL]<5,” < 5%”,IIf([COLUMNL]>=90,”100%”,Format([TBLCLAIMITEMS].[AgreedLoss],”#,##0.0″)))))), qryPriorLoss.FinalTotal, qryPriorLoss.SumOfAgreedThisLoss, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),”NO”,IIf([matchtotalloss]>0,”NO”,(IIf([COLUMNL]<5,”YES”,IIf([COLUMNL]>=90,”YES”,”NO”))))), tblClaimItems.Pickup, tblClaimItems.Nonwaivered, tblClaimItems.Claimed, tblClaimItems.Pickup
HAVING (((tblPolicyItems.CropID)=3 Or (tblPolicyItems.CropID)=14 Or (tblPolicyItems.CropID)=16) AND ((tblClaims.ClaimID)=[tempvars]![tmpclaimid]) AND ((tblClaimItems.Pickup)=True)) OR (((tblPolicyItems.CropID)=3 Or (tblPolicyItems.CropID)=14 Or (tblPolicyItems.CropID)=16) AND ((tblClaims.ClaimID)=[tempvars]![tmpclaimid]) AND ((tblClaimItems.Claimed)=True))
UNION
SELECT tblPolicyItems.CropID, tblPolicyItems.PolicyItemNumber, Sum(tblClaimItemCounts.acresCounted) AS SumOfacresCounted, tblPolicyItems.ActualAcres, tblClaimItems.TypeOfCrop, tblPolicyItems.Quarter, tblPolicyItems.Section, tblPolicyItems.Township, tblPolicyItems.Range, tblPolicyItems.Meridian, tblClaimItems.ClaimNumber, tblClaims.ClaimID, tblClaimItems.ClaimItemID, tblClaims.PolicyID, tblClaimItems.PolicyItemID, tblPolicies.PolicyNum, tblClaimItems.Pickup, tblClaimItems.MatchTotalLoss, tblPolicyItems.InsurancePerAcre, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),[tblclaimitems].[status],IIf([matchtotalloss]>0,[matchtotalloss],(IIf([COLUMNO]<5,” < 5%”,IIf([COLUMNO]>=90,”100%”,Format([TBLCLAIMITEMS].[AgreedLoss],”#,##0.0″)))))) AS FinalTotal, qryPriorLoss.FinalTotal AS FinalTotalPrior, qryPriorLoss.SumOfAgreedThisLoss, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),”NO”,IIf([matchtotalloss]>0,”NO”,(IIf([COLUMNO]<5,”YES”,IIf([COLUMNO]>=90,”YES”,”NO”))))) AS Split, tblClaimItems.Pickup, tblClaimItems.Nonwaivered, tblClaimItems.Claimed
FROM (((tblPolicies INNER JOIN tblClaims ON tblPolicies.PolicyID = tblClaims.PolicyID) INNER JOIN tblPolicyItems ON tblPolicies.PolicyID = tblPolicyItems.PolicyID) INNER JOIN (tblClaimItems LEFT JOIN tblClaimItemCounts ON tblClaimItems.ClaimItemID = tblClaimItemCounts.ClaimItemID) ON tblPolicyItems.PolicyItemID = tblClaimItems.PolicyItemID) LEFT JOIN qryPriorLoss ON tblPolicyItems.PolicyItemID = qryPriorLoss.PolicyItemNumber
GROUP BY tblPolicyItems.CropID, tblPolicyItems.PolicyItemNumber, tblPolicyItems.ActualAcres, tblClaimItems.TypeOfCrop, tblPolicyItems.Quarter, tblPolicyItems.Section, tblPolicyItems.Township, tblPolicyItems.Range, tblPolicyItems.Meridian, tblClaimItems.ClaimNumber, tblClaims.ClaimID, tblClaimItems.ClaimItemID, tblClaims.PolicyID, tblClaimItems.PolicyItemID, tblPolicies.PolicyNum, tblClaimItems.MatchTotalLoss, tblPolicyItems.InsurancePerAcre, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),[tblclaimitems].[status],IIf([matchtotalloss]>0,[matchtotalloss],(IIf([COLUMNO]<5,” < 5%”,IIf([COLUMNO]>=90,”100%”,Format([TBLCLAIMITEMS].[AgreedLoss],”#,##0.0″)))))), qryPriorLoss.FinalTotal, qryPriorLoss.SumOfAgreedThisLoss, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),”NO”,IIf([matchtotalloss]>0,”NO”,(IIf([COLUMNO]<5,”YES”,IIf([COLUMNO]>=90,”YES”,”NO”))))), tblClaimItems.Pickup, tblClaimItems.Nonwaivered, tblClaimItems.Claimed, tblClaimItems.Pickup
HAVING (((tblPolicyItems.CropID)=4 Or (tblPolicyItems.CropID)=41) AND ((tblClaims.ClaimID)=[tempvars]![tmpclaimid]) AND ((tblClaimItems.Pickup)=True)) OR (((tblPolicyItems.CropID)=4 Or (tblPolicyItems.CropID)=41) AND ((tblClaims.ClaimID)=[tempvars]![tmpclaimid]) AND ((tblClaimItems.Claimed)=True))
UNION
SELECT tblPolicyItems.CropID, tblPolicyItems.PolicyItemNumber, Sum(tblClaimItemCounts.acresCounted) AS SumOfacresCounted, tblPolicyItems.ActualAcres, tblClaimItems.TypeOfCrop, tblPolicyItems.Quarter, tblPolicyItems.Section, tblPolicyItems.Township, tblPolicyItems.Range, tblPolicyItems.Meridian, tblClaimItems.ClaimNumber, tblClaims.ClaimID, tblClaimItems.ClaimItemID, tblClaims.PolicyID, tblClaimItems.PolicyItemID, tblPolicies.PolicyNum, tblClaimItems.Pickup, tblClaimItems.MatchTotalLoss, tblPolicyItems.InsurancePerAcre, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),[tblclaimitems].[status],IIf([matchtotalloss]>0,[matchtotalloss],(IIf([COLUMNE]<5,” < 5%”,IIf([COLUMNE]>=90,”100%”,Format([TBLCLAIMITEMS].[AgreedLoss],”#,##0.0″)))))) AS FinalTotal, qryPriorLoss.FinalTotal AS FinalTotalPrior, qryPriorLoss.SumOfAgreedThisLoss, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),”NO”,IIf([matchtotalloss]>0,”NO”,(IIf([COLUMNE]<5,”YES”,IIf([COLUMNE]>=90,”YES”,”NO”))))) AS Split, tblClaimItems.Pickup, tblClaimItems.Nonwaivered, tblClaimItems.Claimed
FROM (((tblPolicies INNER JOIN tblClaims ON tblPolicies.PolicyID = tblClaims.PolicyID) INNER JOIN tblPolicyItems ON tblPolicies.PolicyID = tblPolicyItems.PolicyID) INNER JOIN (tblClaimItems LEFT JOIN tblClaimItemCounts ON tblClaimItems.ClaimItemID = tblClaimItemCounts.ClaimItemID) ON tblPolicyItems.PolicyItemID = tblClaimItems.PolicyItemID) LEFT JOIN qryPriorLoss ON tblPolicyItems.PolicyItemID = qryPriorLoss.PolicyItemNumber
GROUP BY tblPolicyItems.CropID, tblPolicyItems.PolicyItemNumber, tblPolicyItems.ActualAcres, tblClaimItems.TypeOfCrop, tblPolicyItems.Quarter, tblPolicyItems.Section, tblPolicyItems.Township, tblPolicyItems.Range, tblPolicyItems.Meridian, tblClaimItems.ClaimNumber, tblClaims.ClaimID, tblClaimItems.ClaimItemID, tblClaims.PolicyID, tblClaimItems.PolicyItemID, tblPolicies.PolicyNum, tblClaimItems.MatchTotalLoss, tblPolicyItems.InsurancePerAcre, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),[tblclaimitems].[status],IIf([matchtotalloss]>0,[matchtotalloss],(IIf([COLUMNE]<5,” < 5%”,IIf([COLUMNE]>=90,”100%”,Format([TBLCLAIMITEMS].[AgreedLoss],”#,##0.0″)))))), qryPriorLoss.FinalTotal, qryPriorLoss.SumOfAgreedThisLoss, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),”NO”,IIf([matchtotalloss]>0,”NO”,(IIf([COLUMNE]<5,”YES”,IIf([COLUMNE]>=90,”YES”,”NO”))))), tblClaimItems.Pickup, tblClaimItems.Nonwaivered, tblClaimItems.Claimed, tblClaimItems.Pickup
HAVING (((tblPolicyItems.CropID)=13) AND ((tblClaims.ClaimID)=[tempvars]![tmpclaimid]) AND ((tblClaimItems.Pickup)=True)) OR (((tblPolicyItems.CropID)=13) AND ((tblClaims.ClaimID)=[tempvars]![tmpclaimid]) AND ((tblClaimItems.Claimed)=True))
UNION
SELECT tblPolicyItems.CropID, tblPolicyItems.PolicyItemNumber, Sum(tblClaimItemCounts.acresCounted) AS SumOfacresCounted, tblPolicyItems.ActualAcres, tblClaimItems.TypeOfCrop, tblPolicyItems.Quarter, tblPolicyItems.Section, tblPolicyItems.Township, tblPolicyItems.Range, tblPolicyItems.Meridian, tblClaimItems.ClaimNumber, tblClaims.ClaimID, tblClaimItems.ClaimItemID, tblClaims.PolicyID, tblClaimItems.PolicyItemID, tblPolicies.PolicyNum, tblClaimItems.Pickup, tblClaimItems.MatchTotalLoss, tblPolicyItems.InsurancePerAcre, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),[tblclaimitems].[status],IIf([matchtotalloss]>0,[matchtotalloss],(IIf([COLUMNF]<5,” < 5%”,IIf([COLUMNF]>=90,”100%”,Format([TBLCLAIMITEMS].[AgreedLoss],”#,##0.0″)))))) AS FinalTotal, qryPriorLoss.FinalTotal AS FinalTotalPrior, qryPriorLoss.SumOfAgreedThisLoss, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),”NO”,IIf([matchtotalloss]>0,”NO”,(IIf([COLUMNF]<5,”YES”,IIf([COLUMNF]>=90,”YES”,”NO”))))) AS Split, tblClaimItems.Pickup, tblClaimItems.Nonwaivered, tblClaimItems.Claimed
FROM (((tblPolicies INNER JOIN tblClaims ON tblPolicies.PolicyID = tblClaims.PolicyID) INNER JOIN tblPolicyItems ON tblPolicies.PolicyID = tblPolicyItems.PolicyID) INNER JOIN (tblClaimItems LEFT JOIN tblClaimItemCounts ON tblClaimItems.ClaimItemID = tblClaimItemCounts.ClaimItemID) ON tblPolicyItems.PolicyItemID = tblClaimItems.PolicyItemID) LEFT JOIN qryPriorLoss ON tblPolicyItems.PolicyItemID = qryPriorLoss.PolicyItemNumber
GROUP BY tblPolicyItems.CropID, tblPolicyItems.PolicyItemNumber, tblPolicyItems.ActualAcres, tblClaimItems.TypeOfCrop, tblPolicyItems.Quarter, tblPolicyItems.Section, tblPolicyItems.Township, tblPolicyItems.Range, tblPolicyItems.Meridian, tblClaimItems.ClaimNumber, tblClaims.ClaimID, tblClaimItems.ClaimItemID, tblClaims.PolicyID, tblClaimItems.PolicyItemID, tblPolicies.PolicyNum, tblClaimItems.MatchTotalLoss, tblPolicyItems.InsurancePerAcre, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),[tblclaimitems].[status],IIf([matchtotalloss]>0,[matchtotalloss],(IIf([COLUMNF]<5,” < 5%”,IIf([COLUMNF]>=90,”100%”,Format([TBLCLAIMITEMS].[AgreedLoss],”#,##0.0″)))))), qryPriorLoss.FinalTotal, qryPriorLoss.SumOfAgreedThisLoss, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),”NO”,IIf([matchtotalloss]>0,”NO”,(IIf([COLUMNF]<5,”YES”,IIf([COLUMNF]>=90,”YES”,”NO”))))), tblClaimItems.Pickup, tblClaimItems.Nonwaivered, tblClaimItems.Claimed, tblClaimItems.Pickup
HAVING (((tblPolicyItems.CropID)=18) AND ((tblClaims.ClaimID)=[tempvars]![tmpclaimid]) AND ((tblClaimItems.Pickup)=True)) OR (((tblPolicyItems.CropID)=18) AND ((tblClaims.ClaimID)=[tempvars]![tmpclaimid]) AND ((tblClaimItems.Claimed)=True))
UNION SELECT tblPolicyItems.CropID, tblPolicyItems.PolicyItemNumber, Sum(tblClaimItemCounts.acresCounted) AS SumOfacresCounted, tblPolicyItems.ActualAcres, tblClaimItems.TypeOfCrop, tblPolicyItems.Quarter, tblPolicyItems.Section, tblPolicyItems.Township, tblPolicyItems.Range, tblPolicyItems.Meridian, tblClaimItems.ClaimNumber, tblClaims.ClaimID, tblClaimItems.ClaimItemID, tblClaims.PolicyID, tblClaimItems.PolicyItemID, tblPolicies.PolicyNum, tblClaimItems.Pickup, tblClaimItems.MatchTotalLoss, tblPolicyItems.InsurancePerAcre, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),[tblclaimitems].[status],IIf([matchtotalloss]>0,[matchtotalloss],(IIf([COLUMNV]<5,” < 5%”,IIf([COLUMNV]>=90,”100%”,Format([TBLCLAIMITEMS].[AgreedLoss],”#,##0.0″)))))) AS FinalTotal, qryPriorLoss.FinalTotal AS FinalTotalPrior, qryPriorLoss.SumOfAgreedThisLoss, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),”NO”,IIf([matchtotalloss]>0,”NO”,(IIf([COLUMNV]<5,”YES”,IIf([COLUMNV]>=90,”YES”,”NO”))))) AS Split, tblClaimItems.Pickup, tblClaimItems.Nonwaivered, tblClaimItems.Claimed
FROM (((tblPolicies INNER JOIN tblClaims ON tblPolicies.PolicyID = tblClaims.PolicyID) INNER JOIN tblPolicyItems ON tblPolicies.PolicyID = tblPolicyItems.PolicyID) INNER JOIN (tblClaimItems LEFT JOIN tblClaimItemCounts ON tblClaimItems.ClaimItemID = tblClaimItemCounts.ClaimItemID) ON tblPolicyItems.PolicyItemID = tblClaimItems.PolicyItemID) LEFT JOIN qryPriorLoss ON tblPolicyItems.PolicyItemID = qryPriorLoss.PolicyItemNumber
GROUP BY tblPolicyItems.CropID, tblPolicyItems.PolicyItemNumber, tblPolicyItems.ActualAcres, tblClaimItems.TypeOfCrop, tblPolicyItems.Quarter, tblPolicyItems.Section, tblPolicyItems.Township, tblPolicyItems.Range, tblPolicyItems.Meridian, tblClaimItems.ClaimNumber, tblClaims.ClaimID, tblClaimItems.ClaimItemID, tblClaims.PolicyID, tblClaimItems.PolicyItemID, tblPolicies.PolicyNum, tblClaimItems.MatchTotalLoss, tblPolicyItems.InsurancePerAcre, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),[tblclaimitems].[status],IIf([matchtotalloss]>0,[matchtotalloss],(IIf([COLUMNV]<5,” < 5%”,IIf([COLUMNV]>=90,”100%”,Format([TBLCLAIMITEMS].[AgreedLoss],”#,##0.0″)))))), qryPriorLoss.FinalTotal, qryPriorLoss.SumOfAgreedThisLoss, IIf(([tblclaimitems].[status]=”defer”) Or ([tblclaimitems].[status]=”release”) Or ([tblclaimitems].[status]=”incomplete”),”NO”,IIf([matchtotalloss]>0,”NO”,(IIf([COLUMNV]<5,”YES”,IIf([COLUMNV]>=90,”YES”,”NO”))))), tblClaimItems.Pickup, tblClaimItems.Nonwaivered, tblClaimItems.Claimed, tblClaimItems.Pickup
HAVING (((tblPolicyItems.CropID)=17 Or ((tblPolicyItems.CropID) Between 19 And 40) Or ((tblPolicyItems.CropID) Between 42 And 60) Or ((tblPolicyItems.CropID) Between 62 And 75)) AND ((tblClaims.ClaimID)=[tempvars]![tmpclaimid]) AND ((tblClaimItems.Pickup)=True)) OR (((tblPolicyItems.CropID)=17 Or (tblPolicyItems.CropID)=77 OR ((tblPolicyItems.CropID) Between 19 And 40) Or ((tblPolicyItems.CropID) Between 42 And 60) Or ((tblPolicyItems.CropID) Between 62 And 75)) AND ((tblClaims.ClaimID)=[tempvars]![tmpclaimid]) AND ((tblClaimItems.Claimed)=True));

Jeff Shirley

Jeff Shirley

Founder & CEO
Jeff brings over 27 years of experience to the table, along with numerous awards, certifications, and real-world implementations.  His database solutions are currently running in industries including government, mining, agriculture, finance, education, science, research, non-profits, and healthcare businesses around North America and serve thousands of users day to day.  Jeff is a five-time MVP Award recipient for Microsoft Access, acknowledging contributions to community projects, evangelism, and educational outreach on Microsoft technologies.  Today there are less than 50 Access MVP’s worldwide. While Jeff focuses day to day on business management, IoT development, IT integrations and design, database architecture or other typical complex tasks, he also is a co-owner of Blue Heron Gardens, a commercial apiary running over 200 beehives.  Fresh honey is a small perk for many of our clients!

Mitch Redekopp

Partner
Mitch works with our clients day to day ensuring web development and IT projects are done to exceed customer expectations.  His background includes formal training in IT, Microsoft and CompTIA certifications, real-world business experience, and a true dedication to ensuring clients receive timely and professional support on their projects with Rivercity Technology Services.  Given the most difficult requests for IT solutions, Mitchell can assist our clients in finding a path to the best options which deliver results for our clients.  Mitchell is an avid soccer player and Manchester City fan, be sure to talk soccer with him when you can.