Results 1 to 6 of 6
  1. #1
    gem1204 is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    32

    Pie chart based on two columns

    I need to create a pic chart based on two fields and I haven't been able to figure it out.
    I have a field that shows the job number, Hours Completed, and hours remaining.
    Here is my sql



    Code:
    SELECT [Job #] ,TimeCompleted,TimeRemaining FROM dbo_vw_ReleasedJobStatusTimeRemaining
    When a user selects a job # I want to display a chart that shows a pie chart with one slice showing the timecompleted and the other showing the timeremaining.
    I guess normally with a pie chart all the data comes from one field. In this case I have data in two fields so I'm not sure how to get the result I need.
    Can someone please help me?
    I'm using access 2010
    Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Try using a UNION query to restructure the data. There is no wizard or designer for UNION, must type in the SQL View editor window of query designer.

    SELECT [Job #], "Completed" As Category, TimeCompleted As TimeData FROM dbo_vw_ReleasedJobStatusTimeRemaining
    UNION SELECT [Job #], "Remaining", TimeRemaining FROM dbo_vw_ReleasedJobStatusTimeRemaining;

    Chart RowSource sql:
    SELECT Category, TimeData FROM unionqueryname WHERE [Job #] = input criteria. Input criteria could be reference to report RecordSource field or textbox on report.

    BTW, recommend no special characters (#, %, &, @, *, /, \), spaces, punctuation (underscore is exception) in names. Job # should be JobNum or Job_Num.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    gem1204 is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    32
    Thanks!

    I've already left work for the day but I'll give it a try tomorrow and let you know.

  4. #4
    Stingaway is offline Efficiency Junkie
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Location
    The deep south. Keep going until you hit water basically.
    Posts
    224
    Pie charts threaten sanity in Access... Excel makes it look so easy.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Yes, and I was going nuts until someone taught me about UNION query. All of my charts are based on UNION query. I know, I know, it's because my data isn't fully normalized. It's a compromise between normalization and ease of data entry/report design. Charting was the last feature in my project I learned.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    Stingaway is offline Efficiency Junkie
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Location
    The deep south. Keep going until you hit water basically.
    Posts
    224
    I think I have used Union maybe three times for those times when you just couldn't do it any other way. As for the fully normalized part - I have created one (1) completely normalized database in my lifetime. It was perfect. So perfect it was pretty much unusable for end users... Especially those who did not understand why elements had to exist in a table in order to populate another table (or to be selected in a drop down for that matter...)

    These days making it to fourth normal is high-class. Typically I find myself balanced in third dealing with exactly the same compromise you mentioned. Good to know that there are others out there struggling with 'normal' as well.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 08-08-2011, 11:02 AM
  2. Replies: 0
    Last Post: 06-02-2011, 04:19 AM
  3. Replies: 6
    Last Post: 02-24-2011, 03:24 PM
  4. Replies: 2
    Last Post: 07-12-2010, 05:39 AM
  5. Award Customer Points based on sum of Columns
    By JohnBoy in forum Programming
    Replies: 3
    Last Post: 02-20-2010, 02:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums