Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert row to column

Status
Not open for further replies.

access23

Technical User
Jul 25, 2003
8
0
0
US
i have a table contain customer name and address like this:
name address
john doe street
john doe city
john doe state
john doe zip

how do i make the table look like this:

name address1 address2 address3 ...
john doe street city state ...
 
Hi,

If you go into the crosstab query wizard, give it this table, put the name column vertically and the address column as the data it should work.

John
 
Thank for the tip, i tried the crosstab query but it did not give me the result as i want above. Do you have any other suggestions?

new to access
 
This may sound like a smart-a** response, but your best bet is to dump the table and start over correctly. If you have three or four or five records for EVERY PERSON in your table, (which is what your example appears to show) that's a bad design to start with.

The only other way is to design a CORRECT table, then use an APPEND query to put the initial records in, and then a couple of UPDATE queries to populate the other fields, based on a name match.

Jim


Me? Ambivalent? Well, yes and no....
Another free Access forum:
More Access stuff at
 
if you want to try this hack-job:

you have to make another column/field in your table, and put in it

Street
City
Zip
City
Street
City
Zip

blah
for every row.
then do a crosstab query with this new field as ColumnHeading and Name as Row Heading.
 
To WildHare (MIS)
Can you tell me how to run update queries to populate the others fields base on name match? Please
thanks,




 
To GingerR (MIS)

I tried and it's worked. the only problem is i have over 10,000 records to go through. It's great to know the trick. Thanks alot.
 
OK, but let's make sure we're both on the same page first.
Your original table has a record like this:

Name: Address:
John Doe 123 Main Street

and then another record like this
Name: Address:
John Doe Podunk

and then another one like this

Name: Address
John Doe Iowa

e.g., four or so records for every person. Correct?

And your NEW table has a record like this:

Name Street City State Zip
John Doe 123 Main St Podunk Iowa 00000

Right?





Me? Ambivalent? Well, yes and no....
Another free Access forum:
More Access stuff at
 
Hi Access23 - I have gotten ext. busy all of a sudden - but I will try to look at your situ. later this week if you don't get a solution ahead of time. Sorry for the delay.

JMH

If at first you don't succeed, skydiving probably isn't for you!
Another free Access forum:
More Access stuff at
 
Hello, WildHare No problem. Whenever you have time. thanks!


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top