Results 1 to 14 of 14

Thread: [RESOLVED] Access 2000 (Report): Result Orientation

  1. #1

    Thread Starter
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Resolved [RESOLVED] Access 2000 (Report): Result Orientation

    The following is the result set that I'm working with:
    Code:
    C6N	2.3875	2.3200	-4.0000	2.3300
    C6U	2.5000	2.4375	-4.5000	2.4450
    C6Z	2.6400	2.5775	-3.7500	2.5850
    C7H	2.7450	2.6850	-4.2500	2.6925
    C7K	2.8100	2.7625	-4.0000	2.7650
    C7N	2.8850	2.8275	-3.7500	2.8350
    C7Z	2.9600	2.9000	-3.2500	2.9075
    C8H	3.0200	3.0000	-1.5000	3.0000
    C8Z	3.1125	3.1125	.7500	3.1125
    The first letter of the symbol is the commodity, the second is the year and the third is the month (H = March, Z = December, ect). The other fields are the high, lows, change and settlements.

    For the report I'm making, I need the symbols in the first field to repeat horizontally on the report instead of vertically. Under each one, will be the details about that month.

    The question I have is, is there a way (or a control) in access that I can use to change the orientation to display the results horizontally instead of vertically? The result I would like to see on the report is:
    Code:
    C6N	C6U	C6Z	C7H      ...
    2.3875	2.5000	2.6400	2.6400   ...
    2.3200	2.4375	2.5775	2.6850   ...
    -4.0000	-4.5000	-3.7500	-4.2500  ...
    2.3300  2.4450  2.5850  2.6925   ...
    I plan on parsing the symbols so they're easier to read, but first I need to get over this hurdle.

    Thanks in advance.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Access 2000 (Report): Result Orientation

    Yes, your query or report source will be a pivot query.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: Access 2000 (Report): Result Orientation

    Ok, I found PivotTable View in the designer; is that the same thing?

  4. #4

    Thread Starter
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: Access 2000 (Report): Result Orientation

    Ahh, ok (tables not the same thing ). I found this link:
    http://www.blueclaw-db.com/accessque...ivot_query.htm

    I'll try and work with it, see if I can figure it out. Thanks

  5. #5
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Access 2000 (Report): Result Orientation

    For what you are looking for you will need 4 seperate pivot queries with the following synthax.
    Code:
    TRANSFORM Sum(YourTable.High) AS High
    SELECT 'High' AS Measure
    FROM YourTable
    GROUP BY 'High'
    PIVOT YourTable.ThreeLetterCode
    Then
    Code:
    TRANSFORM Sum(YourTable.Low) AS Low
    SELECT 'Low' AS Measure
    FROM YourTable
    GROUP BY 'Low'
    PIVOT YourTable.ThreeLetterCode
    Etc.

    Once you have created a query for each measure, you can then union those resluting queries together in a fifth query.
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  6. #6

    Thread Starter
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: Access 2000 (Report): Result Orientation

    Thanks a ton Kenny. I'll work with it this afternoon. That looks exactly like what I need.

  7. #7

    Thread Starter
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: Access 2000 (Report): Result Orientation

    Ok, back to being a little lost. Here's the first query I ended up using:
    Code:
    TRANSFORM Sum(tblBoardPrices.curHigh) AS High
    SELECT tblBoardPrices.curHigh
    FROM tblBoardPrices
    WHERE tblBoardPrices.strBoardSymbol LIKE "C*"
    GROUP BY tblBoardPrices.curHigh
    PIVOT tblBoardPrices.strBoardSymbol
    Which produced:
    Code:
    curHigh	C6N	C6U	C6Z	C7H	C7K	C7N	C7Z	C8H	C8Z
    $2.37	$2.37								
    $2.48		$2.48							
    $2.63			$2.63						
    $2.73				$2.73					
    $2.80					$2.80				
    $2.88						$2.88			
    $2.95							$2.95		
    $3.02								$3.02	
    $3.15									$3.15
    Is this correct so far? When I make all of them and union, is the format going to be right?

    I've never messed with pivots before, so I'm kinda in a paniced daze right now.
    (Note: I'm not worried about the rounding right now, I can take care of that later.)

  8. #8
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Access 2000 (Report): Result Orientation

    No, youare using the values as lables which is why you are getting the step effect.
    Change your code to
    Code:
    TRANSFORM Sum(tblBoardPrices.curHigh) AS High
    SELECT 'High' As Measure 
    FROM tblBoardPrices
    WHERE tblBoardPrices.strBoardSymbol LIKE "C*"
    GROUP BY 'High' As Measure
    PIVOT tblBoardPrices.strBoardSymbol
    I've just created a 'dummy' field called "Measure" to act as the row label. This should now give you a single row.
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  9. #9
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Access 2000 (Report): Result Orientation

    Slight edit to the above

    Code:
    TRANSFORM Sum(tblBoardPrices.curHigh) AS High
    SELECT 'High' As Measure 
    FROM tblBoardPrices
    WHERE tblBoardPrices.strBoardSymbol LIKE "C*"
    GROUP BY 'High'
    PIVOT tblBoardPrices.strBoardSymbol
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  10. #10

    Thread Starter
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: Access 2000 (Report): Result Orientation

    Ahh, ok. This works if I import the table into access. Unfortunately (and I shouldn't have left this out), I'm using ODBC connections to SQL. The table isn't local.

    If I use the same code for my ODBC connection, I get a "GROUP BY must be in SELECT" error. Is there any other way around this rather then adding a 'dummy' field in SQL?

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Access 2000 (Report): Result Orientation

    you can always link to your SQL tables in Access so you have a linked Access table which will for the most part, act like a local access table.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  12. #12

    Thread Starter
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: Access 2000 (Report): Result Orientation

    It is linked (using an ODBC connection), unless you're reffering to something else?

    For some reason (and I think it has to do with the dummy field), it doesn't work with an ODBC connection. If I import the table from SQL, it ran perfectly. They mentioned something (I think it's what they're talking about) about this in that link i posted:
    Quote Originally Posted by From Link
    Warning about upsize to SQL Server - Access pivot query is not support. There are workarounds which are similar to the functioning of the Histogram Example (#16).
    Should I be looking into this histogram or is there something I'm missing? I'm deffinitely a little dense when it comes to access.

  13. #13
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Access 2000 (Report): Result Orientation

    Yes, thats what I was referring to but how many records are in this table? Is it possible to import the records to Access to isolate it from SQL?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  14. #14

    Thread Starter
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: Access 2000 (Report): Result Orientation

    I think that would work.

    I'm just a little nervous that if they see the new layout, they're going to want the live form to look the same way as this report. If they do... Then I'm going to have to look into another solution because these numbers change every second or two. They're populated by a DTS package I have running and that thing never stops .

    Thanks for all the help Rob and Kenny! Deffinitely got me through this.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width