SubQuery Help

W

William Horton

I have a query (Query2) whose data source is another query (Query1). Query2
when run contains 985 records. In Query2 I need to create a field using the
subquery (Select Sum([Query1]![FieldA]*[Query1]![FieldB] FROM [Query1]).
When I run Query2, on all 985 records I see the correct result of my subquery
(basicallly a SUMPRODUCT). However, I want the result to differ based on a
field that is in Query1 (Plant field). I want Query2 to show a different
subquery result for each Plant field. Does anyone know how I can get this to
work. Basically I want my subquery to return a different result for each
Plant. I know how to do this when there are 2 different data sources X and Y
(WHERE X.Plant=Y.Plant). However, in this case there is only 1 datasource
(Query1). WHERE Query1.Plant=Query1.Plant doesn't work / make sense and when
I use WHERE QUERY2.PLANT=QUERY1.PLANT I get a parameter prompt when I run the
query asking me for the QUERY2.PLANT value.

Any Ideas ???

Thanks,
Bill Horton
 

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