Connecting Tech Pros Worldwide Forums | Help | Site Map

How to transpose rows into columns in Access

Newbie
 
Join Date: Jun 2009
Posts: 1
#1: Jun 18 '09
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.

puppydogbuddy's Avatar
Expert
 
Join Date: May 2007
Location: Florida
Posts: 1,915
#2: Jun 22 '09

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