Results 1 to 5 of 5
  1. #1
    Farida is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2015
    Posts
    19

    Access Cross Tab Query

    Hi, I have the below Parameter Query being used for generating Access Chart.
    -------------------------------
    PARAMETERS [MOC Number Starts With] Text ( 255 );


    TRANSFORM Count(MonthName(Month([CREATED DATE]))) AS ['NUMBER']
    SELECT MonthName(Month([CREATED DATE])) AS ['MONTH'], Count(MOC_DATA.[MOC NUMBER]) AS [Total Of MOC_NUMBER]
    FROM MOC_DATA
    WHERE (((MOC_DATA.[MOC NUMBER]) Like "*" & [MOC Number Starts With] & "*"))
    GROUP BY MonthName(Month([CREATED DATE])), Month([CREATED DATE])
    ORDER BY Month([CREATED DATE])
    PIVOT MOC_DATA.ASSET;
    -------------------------------
    The output is as below

    'MONTH' Total Of MOC_NUMBER CLN Non-Plant Ongoing Outgoing Second Third Four Five
    January 481 32 8 19 72 130 94 68 58
    February 418 17 9 13 50 135 94 47 53
    March 437 14 17 16 54 102 119 59 56
    April 358 17 3 13 39 90 106 45 45
    May 350 24 13 14 59 77 76 56 31
    June 446 20 9 22 67 97 126 44 61
    July 334 15 20 9 74 55 78 42 41
    August 250 12 8 15 43 45 72 28 27
    September 357 20 5 14 81 68 68 33 68
    October 353 30 6 20 63 70 78 45 41
    November 384 31 14 20 72 116 40 52 39
    December 418 16 12 16 72 116 109 39 38


    Please tell me how i can modify my query to shift the Total Of MOC_NUMBER column to the end (after Five column)

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    Query in datasheet, click/grab/drag field to desired position then save the query. The SQL won't look any different but Access saves this somewhere and remembers.
    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
    Farida is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2015
    Posts
    19
    Well, i figured this out. I went to the Report in Design View that holds the Chart / Graph.
    Select the Graph. In the Data tab of Properties window for the Graph, type the Row Source property as you desire.

    Earlier the Row Source was
    SELECT TEST_CREATED_STATISTICS.['MONTH'],
    TEST_CREATED_STATISTICS.[Total Of MOC_NUMBER],
    TEST_CREATED_STATISTICS.[CLN],
    TEST_CREATED_STATISTICS.[Non-Plant],
    TEST_CREATED_STATISTICS.[Ongoing],
    TEST_CREATED_STATISTICS.[Outgoing],
    TEST_CREATED_STATISTICS.[Second],
    TEST_CREATED_STATISTICS.[Third],
    TEST_CREATED_STATISTICS.Four,
    TEST_CREATED_STATISTICS.Five
    FROM TEST_CREATED_STATISTICS;

    Changed it to
    SELECT TEST_CREATED_STATISTICS.['MONTH'],
    TEST_CREATED_STATISTICS.[CLN],
    TEST_CREATED_STATISTICS.[Non-Plant],
    TEST_CREATED_STATISTICS.[Ongoing],
    TEST_CREATED_STATISTICS.[Outgoing],
    TEST_CREATED_STATISTICS.[Second],
    TEST_CREATED_STATISTICS.[Third],
    TEST_CREATED_STATISTICS.Four,
    TEST_CREATED_STATISTICS.Five,
    TEST_CREATED_STATISTICS.[Total Of MOC_NUMBER]
    FROM TEST_CREATED_STATISTICS;

    And it all worked well!!!

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    Ooops, I didn't catch that you were trying to fix SQL for chart RowSource. If you had posted the RowSource SQL for starters, I would have suggested the solution you arrived at. Glad you got it working.
    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.

  5. #5
    Farida is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2015
    Posts
    19

    At that point i didnot know what and where i need to set this to get the output i needed!! Thanks for your prompt response!

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

Similar Threads

  1. Cross Tab Query.
    By cap.zadi in forum Queries
    Replies: 1
    Last Post: 01-04-2012, 01:29 PM
  2. Cross-tab query YTD
    By stremchem in forum Queries
    Replies: 9
    Last Post: 08-26-2010, 10:09 AM
  3. Cross Tab Query
    By RycherX in forum Queries
    Replies: 1
    Last Post: 04-26-2010, 12:19 PM
  4. Cross Tab Query
    By nengster in forum Queries
    Replies: 0
    Last Post: 02-18-2009, 07:12 PM
  5. access cross tab query
    By Hossam in forum Access
    Replies: 0
    Last Post: 11-10-2008, 06:01 AM

Tags for this Thread

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