browse: forums | FAQ
Connecting Tech Pros Worldwide

Hey there! Do you need Microsoft Access / VBA help?

Get answers from our community of Microsoft Access / VBA experts on BYTES! It's free.

Create column from Row value

Tricon
Guest
 
Posts: n/a
#1: Nov 12 '05
Is there a way to create a colum from values in a row?
For example, Let's say I have the following:
12345 Bigfoot 1 $1.00
12345 Bigfoot 2 $2.00
12345 Bigfoot 3 $3.00

Can I turn it into this:

ID NAME 1 2 3
12345 Bigfoot $1.00 $2.00 $3.00


Thanks for all your help guys!

-Tricon



Stuart MacKinnon
Guest
 
Posts: n/a
#2: Nov 12 '05

re: Create column from Row value


triconius@hotmail.com (Tricon) wrote in message news:<deb78947.0311240848.cdebc8@posting.google.co m>...[color=blue]
> Is there a way to create a colum from values in a row?
> For example, Let's say I have the following:
> 12345 Bigfoot 1 $1.00
> 12345 Bigfoot 2 $2.00
> 12345 Bigfoot 3 $3.00
>
> Can I turn it into this:
>
> ID NAME 1 2 3
> 12345 Bigfoot $1.00 $2.00 $3.00
>[/color]

Hi Tricon,

One way is to create a query using the "Cross-tab Query Wizard".

1) Select the ID and Name as "row headings".
2) Select the column containing the values 1,2,3... as the column
heading (I have called this column "Type").
3) The last column left is your dollar column (Which I have called
"Amount"). At the next step, apply the "Sum" function to this column
and it is done.

The underlying SQL for this looks like:

TRANSFORM Sum(tblBigFoot.Amount) AS [The Value]
SELECT tblBigFoot.ID, tblBigFoot.Name, Sum(tblBigFoot.Amount) AS
[Total Of Amount]
FROM tblBigFoot
GROUP BY tblBigFoot.ID, tblBigFoot.Name
PIVOT tblBigFoot.Type;

HTH

Regards
Stuart
Closed Thread