Trouble with a union Query

T

tsison7

Below is a union query which gathers up shipment and returns to give data
representing quality (total returned/total shipped). The query works fine
without the WHERE statement for all customers. But I want to filter it out
for a specific Account Manager's customer's only.

I tried the WHERE statement below, but it doesn't work.

WHERE (((qryQualityRGA.AcctmgrID)=getmyvariable()));

Interesting to me is using that last statement brings up a parameter box
asking for the value of qryQualityRGA.AcctmgrID????


SELECT qryQualityRGA.plant, qryQualityRGA.AcctmgrID,
qryQualityRGA.TransactionDate, qryQualityRGA.QuantityReturned,
qryQualityRGA.QuantityShipped FROM qryQualityRGA UNION ALL SELECT
qryQualityShipped.plant, qryQualityShipped.AcctmgrID,
qryQualityShipped.TransactionDate, qryQualityShipped.QuantityReturned,
qryQualityShipped.QuantityShipped FROM qryQualityShipped
WHERE (((qryQualityShipped.AcctmgrID)=getmyvariable()));
 
J

John W. Vinson

Below is a union query which gathers up shipment and returns to give data
representing quality (total returned/total shipped). The query works fine
without the WHERE statement for all customers. But I want to filter it out
for a specific Account Manager's customer's only.

I tried the WHERE statement below, but it doesn't work.

What "doesn't work"? Did you include the criterion in BOTH SELECT parts or the
UNION query? They're independent, you need the criterion twice.

John W. Vinson [MVP]
 

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