need help with report

J

jkendrick75

my report looks like the following,
-Page Header----------------------------------------------------------------
Defect Codes for Part [=[Forms]![frmbyparts]![cboPartnum].Value]
Shift Number =[Forms]![frmByParts]![cboshift].Value
Between [=[Forms]![frmByParts]![StartDate]] and
=[Forms]![frmByParts]![EndDate]
-PartNumber Header-------------------------------------------------------
[=Sum([sumofdefect1_quantity])](hidden attributes)
Defect Codes Defect Quantity/Code Percentage of Defects
-Detail-----------------------------------------------------------------------
[=Count([sum of defQuantity])/Count([sum of defquantity])] (hidden value,
summed over group in report)
[SumOfTotalSort] (hidden value)
[Defect_Code] [SumOfDefect1_Quantity]
[=([sumofdefect1_quantity]/[txtDefQtySum])*100]
-Part Number Footer------------------------------------------------------
Total Parts Ran [SumOfTotalPartsRan] Total Good Parts
[=[txtpartsum]-[txtpartdefectsum]
Total Defects/Part [=Sum([sumofdefect1_quantity])] Defect Percentage
[=(Sum([sumofdefect1_quantity])/[SumOfTotalPartsRan])*100]
-ReportFooter--------------------------------------------------------------

what the report should look like when i am using a sample of information,

Defect Codes for Part {AW060352-16312T}
Between {01/01/2005} and {01/20/2005}
Defect Codes Defect Quantity/Code Percentage of Defects
{26} {19} {35.19}
{25} {1} {1.85}
{24} {9} {16.67}
{20} {16} {29.63}
{15} {5} {9.26}
{7} {4} {5.38}
Total Parts Ran {7,690} Total Good Parts {7,636}
Total Defects/Part {54} Defect Percentage {0.70}

i am getting for the total parts ran {12,645} so the total good parts and
defect percentage is off. however i am getting the correct number for the
total defects/Part. this reports recordsource is a query called
qryPartbyDateRange.
the sql for it is
SELECT Sum(qryDefectsPerIDCode.[sum of defquantity]) AS [Sum Of
DefQuantity], Sum([TBL defect count].TotalSort) AS SumOfTotalSort,
qryDefectsPerIDCode.DefCode, [TBL defect count].[Part Number]
FROM [TBL defect count] LEFT JOIN qryDefectsPerIDCode ON [TBL defect
count].ID = qryDefectsPerIDCode.ID
WHERE ((([TBL defect count].[Part
Number])=[forms]![frmPartbyDateRange]![cboPartNum].[value]) AND (([TBL defect
count].Date) Between [forms]![frmpartbydaterange]![txtStartDate] And
[forms]![frmpartbydaterange]![txtEndDate]))
GROUP BY qryDefectsPerIDCode.DefCode, [TBL defect count].[Part Number]
HAVING ((([TBL defect count].[Part
Number])=[forms]![frmPartbyDateRange]![cboPartNum].[value]));

the query qryPartbyDateRange works off a query called qryDefectsPerIDCode
with the sql as follows
SELECT DISTINCTROW tblDefects.ID, Sum(tblDefects.DefQuantity) AS [sum of
defquantity], tblDefects.DefCode
FROM tblDefects
GROUP BY tblDefects.ID, tblDefects.DefCode;

when i run the qryPartbyDateRange query in data sheet view i get the
following (with colum names shortened for space)

SumDefQty SumTtlSrt DefCode PartNum
3300 AW060352-16312T
4 1695 7 AW060352-16312T
5 900 15 AW060352-16312T
16 1230 20 AW060352-16312T
9 2458 24 AW060352-16312T
1 100 25 AW060352-16312T
19 2962 26 AW060352-16312T

the two tables that all the data is coming from is TBL defect count and
tblDefects.
tblDefects holds an autoID field which is setup to be an autonumber field.
an ID field which is the same number from Tbl defect count's ID field
(autonumber is tbl defect count). for every record in TBL defect count, there
could be anywhere from 0 to 27 records in tblDefects tied to the same ID
number from TBL defect count.

i have spent awhile trying everything i can think of, to no avail. any help
anybody can offer would be much appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top