Chat with a LIVE Microsoft Access Expert!
 
       
 

         

   

Go Back   Access World Forums > Microsoft Access Discussion > Queries

 
 
Chat with a LIVE Microsoft Access Expert!
Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 06-07-2007, 03:16 PM
Lynn73 Lynn73 is offline
Registered User
 
Join Date: Jun 2007
Location: UK
Posts: 25
Lynn73 is on a distinguished road
How do I show convert vertical entries to show horizontally

Is it possible to convert fields listed down to show across.

IDNo Code Position
AAA B01 1
AAA C01 2
AAA D01 3
AAA E01 4

I want to show it as
IDNo Code Code Code Code
AAA B01 C01 D01 E01

Is this possible using Access 2003?
Reply With Quote
Sponsored Links
  #2  
Old 06-07-2007, 07:14 PM
Lissa Lissa is offline
Registered User
 
Join Date: Apr 2007
Location: SATX
Posts: 107
Lissa is on a distinguished road
Try searching for ways to create "pivot tables". I think that's what you are describing....
__________________
GoSpursGo
Reply With Quote
  #3  
Old 06-08-2007, 05:27 AM
Lynn73 Lynn73 is offline
Registered User
 
Join Date: Jun 2007
Location: UK
Posts: 25
Lynn73 is on a distinguished road
I actually want to show the data rather than count it. Is a pivot the best way to go for that?
Reply With Quote
  #4  
Old 06-08-2007, 05:31 AM
kidrobot kidrobot is offline
Registered User
 
Join Date: Apr 2007
Location: GA
Posts: 410
kidrobot is on a distinguished road
Transpose function? You can do this in Excel, I have never tried in Access.
Reply With Quote
  #5  
Old 06-08-2007, 06:40 AM
stopher's Avatar
stopher stopher is offline
AWF VIP
 
Join Date: Feb 2006
Location: Southampton, UK
Posts: 1,033
stopher has a spectacular aura aboutstopher has a spectacular aura about
You can create a crosstab query (a kind of pivot table).

If you table name is myTable then the query will be:
Code:
TRANSFORM First(Code) AS FirstCode
SELECT IDNo
FROM myTable
GROUP BY IDNo
PIVOT Position
Note that the field "Position" will be used as your header i.e. in your example data you will have column headers 1-4.

hth
Stopher
Reply With Quote
  #6  
Old 06-19-2007, 01:38 PM
Lynn73 Lynn73 is offline
Registered User
 
Join Date: Jun 2007
Location: UK
Posts: 25
Lynn73 is on a distinguished road
This works great!!!
Thanks for your help!

One last thing - I have some entries where the code field may be empty - is it possible to include them in this query or would I be better running a separate append query?
Thanks
Reply With Quote
  #7  
Old 06-22-2007, 07:40 AM
stopher's Avatar
stopher stopher is offline
AWF VIP
 
Join Date: Feb 2006
Location: Southampton, UK
Posts: 1,033
stopher has a spectacular aura aboutstopher has a spectacular aura about
Quote:
Originally Posted by Lynn73 View Post
One last thing - I have some entries where the code field may be empty - is it possible to include them in this query or would I be better running a separate append query?
I'm not quite sure what you mean. Can you show an example of what you want you want to see for a blank value for code.
Stopher
Reply With Quote
  #8  
Old 06-22-2007, 01:42 PM
Lynn73 Lynn73 is offline
Registered User
 
Join Date: Jun 2007
Location: UK
Posts: 25
Lynn73 is on a distinguished road
Some records will be populated with a code and some may not yet be coded or may never have a code allocated to them

IDNo Code Position
AAA B01 1
AAA C01 2
AAA D01 3
AAA E01 4
BBB
CCC

When I run the crosstab query it only listed the records with a code allocated and doesn't include any rows without a code.

Thanks
Reply With Quote
Sponsored Links
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
show total entries from a table on a form suggy Forms 1 05-14-2006 01:18 PM
all entries to show up in form Kekss Forms 1 02-25-2005 10:23 PM
Show customer once even though many entries Stuart Green Queries 6 01-14-2004 08:33 AM


All times are GMT -8. The time now is 07:47 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
(c) copyright 2009 Access World