Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
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 Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 11th, 2009, 10:51 AM
Authorized User
 
Join Date: Feb 2005
Posts: 47
Thanks: 2
Thanked 0 Times in 0 Posts
Default 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
 
Old January 13th, 2009, 04:52 AM
Authorized User
 
Join Date: Feb 2005
Posts: 47
Thanks: 2
Thanked 0 Times in 0 Posts
Angry

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.
 
Old January 13th, 2009, 09:27 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

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:
kuznickic (January 13th, 2009)
 
Old January 13th, 2009, 08:06 PM
Authorized User
 
Join Date: Feb 2005
Posts: 47
Thanks: 2
Thanked 0 Times in 0 Posts
Default

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
 
Old January 13th, 2009, 08:31 PM
Authorized User
 
Join Date: Feb 2005
Posts: 47
Thanks: 2
Thanked 0 Times in 0 Posts
Default

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.
 
Old January 13th, 2009, 08:46 PM
Authorized User
 
Join Date: Feb 2005
Posts: 47
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Okay just one quick question. How do I change the labels to say Complete and Not Complete.

Thanks
Chris
 
Old January 14th, 2009, 02:48 AM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

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:
kuznickic (January 15th, 2009)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Pie Chart jomet Pro JSP 2 March 10th, 2008 10:42 PM
Help on Pie Chart DudeBori82 Classic ASP Professional 9 May 3rd, 2005 04:24 PM
Pie-Chart crmpicco Javascript How-To 2 February 10th, 2005 06:34 AM
session.use_trans_sid is driving me crazy!! Snib Pro PHP 6 July 24th, 2004 04:51 AM
Pie Chart lryckman Access 0 April 26th, 2004 11:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.