Display query parameters in a chart

R

Ryan

I have created a report based on a query that has parameters where I enter a
start date and an end date. I have no issue with displaying the paremeter
dates in the header of the report.

My issue is that when I use the same query to create a chart I cannot
display the paremeter dates in the chart or the chart header. Does anyone
know how to display the parameter values from a query in a chart?
 
R

Ryan

Thanks Duane.That was very helpful.

Do you know how to edit parameters so that if a mixture of the parameters
are left blank it does give an error. I can get my query to run if all of the
parameters are blank but not if a mixture are filled in and blank? Thanks
again.
 
R

Ryan

The SQL is:
SELECT Count(UPDPurchaseOrdersTBL.Item) AS CountOfItem,
UPDPurchaseOrdersTBL.PGr
FROM UPDPurchaseOrdersTBL
WHERE (((UPDPurchaseOrdersTBL.[Doc Date]) Between
[Forms]![PurchasingGroupActivityFORM]![Start Date] And
[Forms]![PurchasingGroupActivityFORM]![End Date]) AND
((UPDPurchaseOrdersTBL.PGr) Between
[Forms]![PurchasingGroupActivityFORM]![Purchasing Group Start] And
[Forms]![PurchasingGroupActivityFORM]![Purchasing Group End]))
GROUP BY UPDPurchaseOrdersTBL.PGr;

I do not get a specific error message.

If I enter the start date and an end date but no purchasing group the query
gives me no data. If I do not enter the purchasing groups I want the query to
select all of them. Do I need some sort of default if the data is blank???
Thanks for your help.
 
D

Duane Hookom

Try something like:
SELECT Count(Item) AS CountOfItem, PGr
FROM UPDPurchaseOrdersTBL
WHERE [Doc Date] Between
[Forms]![PurchasingGroupActivityFORM]![Start Date] And
[Forms]![PurchasingGroupActivityFORM]![End Date]
AND PGr Between
Nz([Forms]![PurchasingGroupActivityFORM]![Purchasing Group Start],[PGr])
And
Nz([Forms]![PurchasingGroupActivityFORM]![Purchasing Group End],[PGr])
GROUP BY PGr;

--
Duane Hookom
Microsoft Access MVP


Ryan said:
The SQL is:
SELECT Count(UPDPurchaseOrdersTBL.Item) AS CountOfItem,
UPDPurchaseOrdersTBL.PGr
FROM UPDPurchaseOrdersTBL
WHERE (((UPDPurchaseOrdersTBL.[Doc Date]) Between
[Forms]![PurchasingGroupActivityFORM]![Start Date] And
[Forms]![PurchasingGroupActivityFORM]![End Date]) AND
((UPDPurchaseOrdersTBL.PGr) Between
[Forms]![PurchasingGroupActivityFORM]![Purchasing Group Start] And
[Forms]![PurchasingGroupActivityFORM]![Purchasing Group End]))
GROUP BY UPDPurchaseOrdersTBL.PGr;

I do not get a specific error message.

If I enter the start date and an end date but no purchasing group the query
gives me no data. If I do not enter the purchasing groups I want the query to
select all of them. Do I need some sort of default if the data is blank???
Thanks for your help.

Duane Hookom said:
Could you provide the SQL of your query as well as the "error" specifics?
 

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