Connecting Tech Pros Worldwide Help | Site Map

How to transpose rows into columns in Access

  #1  
Old June 18th, 2009, 05:56 PM
Newbie
 
Join Date: Jun 2009
Posts: 1
Hi,
I have seen other threads with the same question but I'm not too familiar with Access and their solutions often include writing VB code or very complex SQL statements. What I want to do is display each city in which there are offices as columns and the respective user names in rows underneath the columns.
This is how the data needs to appear in Excel:

New York San Diego Kansas City
Smith, John Smith, Jane Correia, Sabrina
Brown, Sandra Rodriguez, Carlos DePalma, John
McCain, Stephanie Johnson, Debra Obrera, Sonya
O’Brien, James
Instead of:

City User
New York Smith, John
New York Brown, Sandra
New York McCain, Stephanie
San Diego Smith, Jane
San Diego Rodriguez, Carlos
San Diego Johnson, Debra
San Diego O’Brien, James
Kansas City Correia, Sabrina
Kansas City DePalma, John
Kansas City Obrera, Sonya

All the user names are stored in one table, i.e. ASSOCIATES. What I tried doing was creating a query for every city with the list of names and then creating one final query to list the contents of each query as a column. This, however, causes Access to create so many rows of duplicate names that the computer runs out of memory. I’m assuming this is because there are no drawn relationships in the query. I wouldn’t mind having a few hundred duplicate names because I can filter with Excel but I do mind 297,233 rows of repeated names! Is there any way in Access or Excel to accomplish this?
Any help would be highly appreciated.
  #2  
Old June 22nd, 2009, 09:20 PM
puppydogbuddy's Avatar
Expert
 
Join Date: May 2007
Location: Florida
Posts: 1,915

re: How to transpose rows into columns in Access


The easiest way I know of is to copy, paste, compile, run MS's Transposer function as shown in the link:
http://support.microsoft.com/kb/202176

If you not want to use the code approach above, you can always use the Transpose option that appears when you copy/cut and paste in Excel. This would require you to export your Access file to Excel, do the Transpose in Excel, then Export the Excel file back to Access. The import and export commands are usually on the File command menu in Access and on the Tools Command Menu in Excel.
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I transpose a table/query in Access? jenniferhelen answers 11 September 21st, 2009 11:02 AM
SQL Query to transpose data from rows into columns Haas C answers 4 August 29th, 2008 05:05 AM
Query to transpose rows to columns via Primary Key m.wanstall answers 8 December 11th, 2006 04:55 AM
Access 2003: Request help on pivot table query Alan Lane answers 4 November 13th, 2005 06:33 AM