Results 1 to 7 of 7
  1. #1
    tmcrouse is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Apr 2009
    Posts
    169

    Crosstab Query Issue

    I am trying to create a crosstab query with no values. The value is actual the value of a field. Here is an example of the fields I have: Note I have 6334 distinct rows with various measure, program and states so this is just an example. I tried Crosstab but it does not work how I need. Then tried putting the 6334 rows in Excel and pivot and that layout did not work.

    Measure Program State
    ADHD OutCall CA
    ADHD Behavior CA
    ADHD Freestand CA


    ADHD OutCall WI
    ADHD Behavior WI
    ADHD Freestand WI
    Depression Outcall CA
    Depression Freestand CA
    Depression Mailer CA
    Depression Freestand WI
    Depression Mailer WI


    Layout Need

    Measure CA WI
    ADHD Outcall Outcall
    Behavior Behavior
    Freestand Freestand
    Depression Outcall Freestand
    Freestand Mailer
    Mailer


    Any thoughts?

  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,770
    The output makes no sense to me. What are the rules that determine what values goes where?

    For instance, why does Depression have only one line and is associated with Outcall and Freestand but not Mailer? Why is there a line that associates Freestand and Mailer? Why: Behavior Behavior; Freestand Freestand? Why is Mailer on a line by itself?
    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
    tmcrouse is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Apr 2009
    Posts
    169
    I wished I could paste a layout that would maintain cell integrity on here. Let me try a picture paste and maybe that will help. ugh it does not let me paste a picture. ok let me try an upload of a file. Well that did not work. I am trying to paste the format. I have a table that has:

    column(measure)
    column(program)
    column(state)

    If I run a query and output in crosstab so that states all appear across the top. All 51, then measure is the row all down the far left side then I want the program grouped by my measure. The problem is crosstab wants values and the field has the name of the program. I am not sure how to post an example since the .doc with picture I pasted of example output in Excel will not work.

    I have Googled all day today trying to find out how to crosstab where my value is the actual program names not numeric values. I can count the programs but that is not the output they want. Darn I wished I could attach an Excel in here. Got picture pasted
    Attached Thumbnails Attached Thumbnails Presentation1.jpg  

  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,770
    Can attach Excel or Access or other files. Zip if larger than 500KB - 2MB zip allowed - use Windows Compression.

    Can build tables in post in the Advanced editor.

    Are CA and WI the only states or do you have all 50 + WDC, Puerto Rico, Guam, Virgin Islands, etc?

    Out of the ordinary data manipulation can require the use of VBA and temp tables as well as queries. Review: http://forums.aspfree.com/microsoft-...ry-322123.html

    and http://www.datapigtechnologies.com/f.../crosstab.html
    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
    tmcrouse is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Apr 2009
    Posts
    169
    Yes all states the overall file is 6446. I am not familiar enough with VBA to figure it out. Right now I have just pasted it all in Excel and manually doing it. Kind of blown away that a crosstab in Excel or Access cannot handle this type of function without VBA code. I don't have time to attempt to figure out code for this as this was thrown on me with all my massive other projects and I was told drop everything do this by EOD Friday. So rather than waste my time trying to fish around for some code I am to row 539 doing it manually. Thanks

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Crosstab needs another Row Heading. Perhaps the Program can be both Row and Value criteria. This seems to work:

    TRANSFORM First(Table1.Program) AS FirstOfProgram
    SELECT Table1.Measure, Table1.Program
    FROM Table1
    GROUP BY Table1.Measure, Table1.Program
    PIVOT Table1.State;
    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.

  7. #7
    tmcrouse is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Apr 2009
    Posts
    169
    Thanks, I will use that and that will be less manual stuff I have to do when I paste to Excel. They want it to group the programs under the measure under the state and now have the measure duplicated. Meaning if ADHD has 4 programs under it, measure shows up 1 time on the left and then the 2nd column the 4 programs under it and block it all and do this freezing of panes in Excel yada yada. But with this transform it will make it far faster than what I am doing with copy paste stuff. Thanks

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

Similar Threads

  1. Crosstab Query Chart Issue
    By james28 in forum Reports
    Replies: 5
    Last Post: 07-08-2014, 04:14 PM
  2. CrossTab Query - Report Issue ?
    By AndreasPanayiotou in forum Reports
    Replies: 0
    Last Post: 09-25-2012, 01:11 AM
  3. Crosstab Query issue
    By ryanwoehl in forum Queries
    Replies: 1
    Last Post: 01-24-2012, 08:44 PM
  4. A CrossTab & Currancy Issue
    By djclntn in forum Queries
    Replies: 3
    Last Post: 12-04-2011, 09:06 PM
  5. Crosstab issue
    By teedee in forum Queries
    Replies: 5
    Last Post: 02-07-2011, 10:49 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