|
|
 |
| Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

January 11th, 2009, 09:51 AM
|
|
Authorized User
|
|
Join Date: Feb 2005
Location: Honoulu, HI, USA.
Posts: 42
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
Access Pie Chart driving me crazy
Hi all,
I am trying what I would think is pretty basic but I can't figure it out. I have one yes/no in a table that I want to display in a pie chart. I want to show all the yes and all the no's. I have created a query that counts the yesses and nos so that should populate the pie chart. I just can't figure out how to display this and like the title says it is driving me crazy. Any help would be greatly appreciated.
Thanks,
Chris
|

January 13th, 2009, 03:52 AM
|
|
Authorized User
|
|
Join Date: Feb 2005
Location: Honoulu, HI, USA.
Posts: 42
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
Okay can somebody anybody please please help. I am getting desperate and have spent about a whole day researching and can't figure this out. I am begging anyone to help me.  
|

January 13th, 2009, 08:27 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,048
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
Here is what I did.
I created a table with a Yes/No field, and populated it with sample data.
I then created a query that looks like this:
Query1:
SELECT Count(Table1.SampleID) AS CountOfSampleID, Table1.YesOrNo
FROM Table1
GROUP BY Table1.YesOrNo;
This grouped the Yes and No responses and gave me the following output in the query:
CountOfSampleID YesOrNo
5 Yes (checkbox)
3 No (checkbox)
I then created a report in Design View, and inserted a chart in the Detail Section:
Insert > Chart > Queries > Query1 > both fields > Pie Chart > Next > Name: Chart1
Then I open the report and the chart shows up as it should, with the legend -1, 0. This is because I didn't change the actual field to a Yes / No selection but kept the default -1/0.
What are you doing that is causing problems?
__________________
mmcdonal
Look it up at: http://wrox.books24x7.com
|
|
The Following User Says Thank You to mmcdonal For This Useful Post:
|
|

January 13th, 2009, 07:06 PM
|
|
Authorized User
|
|
Join Date: Feb 2005
Location: Honoulu, HI, USA.
Posts: 42
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
Thanks mmc,
I'll give that a go. I think the problem rests more with my understanding of how pie charts work than Access. I know VBA but never really had to create any kind of charting capability before. Charts for whatever reason confuse me. I can create a query and view the chart in PivotChart view in the query but I just can't seem to make it work when I go to the report and try to create a chart in design view. The query I am using is this
Code:
SELECT Sum(Abs([Complete])) AS Completed, Sum(IIf([Complete],0,1)) AS NotComplete, Count("*") AS Total
FROM tblDiscrepancies;
. I think too that the chart designer in Access is not that intuitive.
Thanks,
Chris
|

January 13th, 2009, 07:31 PM
|
|
Authorized User
|
|
Join Date: Feb 2005
Location: Honoulu, HI, USA.
Posts: 42
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
mmcdonal
THANK YOU, THANK YOU, THANK YOU!!!!
Works like a charm. I knew it couldn't be hard but for whatever reason that problem was kicking my okole.
Again many thanks.
|

January 13th, 2009, 07:46 PM
|
|
Authorized User
|
|
Join Date: Feb 2005
Location: Honoulu, HI, USA.
Posts: 42
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
Okay just one quick question. How do I change the labels to say Complete and Not Complete.
Thanks
Chris
|

January 14th, 2009, 01:48 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,197
Thanks: 3
Thanked 57 Times in 56 Posts
|
|
What do the labels say now???
I would *HOPE* that the chart is smart enough to pick up the names from your SQL query. Which means you SHOULD be able do do
Code:
SELECT Sum(Abs([Complete])) AS [Complete ],
Count(*) - Sum(Abs([Complete])) AS [Not Complete],
Count(*) AS [Total]
FROM tblDiscrepancies;
(Hope you didn't mind my simplifying your query slighly.) I put a space into [Complete ] so that the name would be the same as the name of a field. Sometimes the query engine chokes if you use a field name for an alias. It shouldn't, but it does.
|
|
The Following User Says Thank You to Old Pedant For This Useful Post:
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |