J
J Sedoff
I am modifying an Access 2000 database in which my "qryMB59" query is merging
a table to show one other piece of information and an older query
"qryMB51Test."
When I run MB51 for a particular day, I get 54 results; but when I run the
new MB59, I only get 41 results because there are some entries that have
similar values (I presume Access must see them as repeated/multiple entries,
but they are in fact true separate entries with identical values) which get
filtered out as I have the "Total" row displayed and everything is set to
"Group By." If I don't have the "Total" row displayed, I get >9000 results
which are the same entries but copied anywhere from 150-225 times, but I
don't know why.
Any suggestions on how to fix this would be much appreciated!
Thanks, Jim
In case these help you,
SQL of MB59:
SELECT qryMB51Test.[Pstg date], qryMB51Test.Material,
qryMB51Test.Description, qryMB51Test.Wgts, qryMB51Test.Amount,
qryMB51Test.MvT, qryMB51Test.Reason, tblZPPR571110503.MTyp, qryMB51Test.[Type
2]
FROM qryMB51Test LEFT JOIN tblZPPR571110503 ON qryMB51Test.Material =
tblZPPR571110503.Component
GROUP BY qryMB51Test.[Pstg date], qryMB51Test.Material,
qryMB51Test.Description, qryMB51Test.Wgts, qryMB51Test.Amount,
qryMB51Test.MvT, qryMB51Test.Reason, tblZPPR571110503.MTyp, qryMB51Test.[Type
2]
HAVING (((qryMB51Test.MvT)<>"Z09" And (qryMB51Test.MvT)<>"Z10" And
(qryMB51Test.MvT)<>"Z51" And (qryMB51Test.MvT)<>"Z52" And
(qryMB51Test.MvT)<>"909" And (qryMB51Test.MvT)<>"910"))
ORDER BY qryMB51Test.Material, tblZPPR571110503.MTyp;
SQL of MB51Test:
SELECT tblMB51Test.[Pstg date], tblMB51Test.Material,
tblMB51Test.Description, IIf([EUn]="G",[Quantity]/454,[Quantity]) AS Wgts,
tblMB51Test.Amount, tblMB51Test.MvT, tblMB51Test.EUn, tblMB51Test.Reason,
IIf([Reason]="0037","DPT",IIf([MvT]="Z09" Or [MvT]="Z10" Or [MvT]="909" Or
[MvT]="910" Or [MvT]="z51" Or
[MvT]="z52","Skimming",IIf([BISMT]<29999,"Milk",IIf([BISMT]>=300000 And
[BISMT]<=399999,"Fruit",IIf([BISMT]>=40000 And
[BISMT]<60000,"Pkg",IIf([EUn]="ea" Or [EUn]="m2" Or [EUn]="ml" Or
[EUn]="PC","Pkg",IIf([EUn]="G","Milk",IIf([BISMT]>60000,"Milk","Fruit")))))))) AS [Type 2]
FROM (tblMB51Test INNER JOIN tbl2004CloseSchd ON tblMB51Test.[Pstg date] =
tbl2004CloseSchd.Date) LEFT JOIN tblMaterialConversion ON
tblMB51Test.Material = tblMaterialConversion.MATNR
WHERE (((tblMB51Test.[Pstg date])=[Forms]![Enter Date]![Text0]) AND
((tblMB51Test.MvT)<>"555") AND ((tblMB51Test.Reason)<>"0101"))
ORDER BY IIf([Reason]="0037","DPT",IIf([MvT]="Z09" Or [MvT]="Z10" Or
[MvT]="909" Or [MvT]="910" Or [MvT]="z51" Or
[MvT]="z52","Skimming",IIf([BISMT]<29999,"Milk",IIf([BISMT]>=300000 And
[BISMT]<=399999,"Fruit",IIf([BISMT]>=40000 And
[BISMT]<60000,"Pkg",IIf([EUn]="ea" Or [EUn]="m2" Or [EUn]="ml" Or
[EUn]="PC","Pkg",IIf([EUn]="G","Milk",IIf([BISMT]>60000,"Milk","Fruit"))))))));
a table to show one other piece of information and an older query
"qryMB51Test."
When I run MB51 for a particular day, I get 54 results; but when I run the
new MB59, I only get 41 results because there are some entries that have
similar values (I presume Access must see them as repeated/multiple entries,
but they are in fact true separate entries with identical values) which get
filtered out as I have the "Total" row displayed and everything is set to
"Group By." If I don't have the "Total" row displayed, I get >9000 results
which are the same entries but copied anywhere from 150-225 times, but I
don't know why.
Any suggestions on how to fix this would be much appreciated!
Thanks, Jim
In case these help you,
SQL of MB59:
SELECT qryMB51Test.[Pstg date], qryMB51Test.Material,
qryMB51Test.Description, qryMB51Test.Wgts, qryMB51Test.Amount,
qryMB51Test.MvT, qryMB51Test.Reason, tblZPPR571110503.MTyp, qryMB51Test.[Type
2]
FROM qryMB51Test LEFT JOIN tblZPPR571110503 ON qryMB51Test.Material =
tblZPPR571110503.Component
GROUP BY qryMB51Test.[Pstg date], qryMB51Test.Material,
qryMB51Test.Description, qryMB51Test.Wgts, qryMB51Test.Amount,
qryMB51Test.MvT, qryMB51Test.Reason, tblZPPR571110503.MTyp, qryMB51Test.[Type
2]
HAVING (((qryMB51Test.MvT)<>"Z09" And (qryMB51Test.MvT)<>"Z10" And
(qryMB51Test.MvT)<>"Z51" And (qryMB51Test.MvT)<>"Z52" And
(qryMB51Test.MvT)<>"909" And (qryMB51Test.MvT)<>"910"))
ORDER BY qryMB51Test.Material, tblZPPR571110503.MTyp;
SQL of MB51Test:
SELECT tblMB51Test.[Pstg date], tblMB51Test.Material,
tblMB51Test.Description, IIf([EUn]="G",[Quantity]/454,[Quantity]) AS Wgts,
tblMB51Test.Amount, tblMB51Test.MvT, tblMB51Test.EUn, tblMB51Test.Reason,
IIf([Reason]="0037","DPT",IIf([MvT]="Z09" Or [MvT]="Z10" Or [MvT]="909" Or
[MvT]="910" Or [MvT]="z51" Or
[MvT]="z52","Skimming",IIf([BISMT]<29999,"Milk",IIf([BISMT]>=300000 And
[BISMT]<=399999,"Fruit",IIf([BISMT]>=40000 And
[BISMT]<60000,"Pkg",IIf([EUn]="ea" Or [EUn]="m2" Or [EUn]="ml" Or
[EUn]="PC","Pkg",IIf([EUn]="G","Milk",IIf([BISMT]>60000,"Milk","Fruit")))))))) AS [Type 2]
FROM (tblMB51Test INNER JOIN tbl2004CloseSchd ON tblMB51Test.[Pstg date] =
tbl2004CloseSchd.Date) LEFT JOIN tblMaterialConversion ON
tblMB51Test.Material = tblMaterialConversion.MATNR
WHERE (((tblMB51Test.[Pstg date])=[Forms]![Enter Date]![Text0]) AND
((tblMB51Test.MvT)<>"555") AND ((tblMB51Test.Reason)<>"0101"))
ORDER BY IIf([Reason]="0037","DPT",IIf([MvT]="Z09" Or [MvT]="Z10" Or
[MvT]="909" Or [MvT]="910" Or [MvT]="z51" Or
[MvT]="z52","Skimming",IIf([BISMT]<29999,"Milk",IIf([BISMT]>=300000 And
[BISMT]<=399999,"Fruit",IIf([BISMT]>=40000 And
[BISMT]<60000,"Pkg",IIf([EUn]="ea" Or [EUn]="m2" Or [EUn]="ml" Or
[EUn]="PC","Pkg",IIf([EUn]="G","Milk",IIf([BISMT]>60000,"Milk","Fruit"))))))));