INSERT INTO Via Cross Tab

A

AVNN

I am trying to add & distribute yearly sales of an year in to months and
inserting them in a table. And for all this purpose I am trying to use
single/one query. I am first using insert into and than using pivot.

On a website I saw the below pivot query and I only added INSERT INTO
tableXXX of my own,

INSERT INTO tblXXX
TRANSFORM Sum(Sales) AS [Gross Total]
SELECT product, FROM tblSales GROUP BY product PIVOT Format(Date,"mmm") In
"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep", "Oct","Nov","Dec")

But this query generates errors. Can someone please tell how can I use
INSERT INTO and pivot in the same query.

I would very much appreciate if any can quote an example query.


Regards,
 
M

Michel Walsh

Have you tried:


INSERT INTO tblXXX(poroduct, jan, feb, mar, apr, may, jun, jul, aug, sep,
oct, nov, dec)
SELECT product, jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec
FROM crosstabQuery



(ie, making it in TWO queries, the saved crosstab and the insert into query)
?
Note that the field name list following tableXXX, tableXXX( ...here... ) ,
have to be made of field defined in tableXXX. I here assumed they where the
same name than for the crosstab.




Hoping it may help
Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top