ouestque
asked on
Access:Create a Table Sum of Categories
I have Table1. I need a second table to be generated from this table that will list each distinct category in table1 followed by the total cost in that category. How would I write VB to do this? (See tables below )
Table1: THIS IS WHAT I HAVE
Field: Book Categories Book Purchases
Fiction $30.02
Fiction $10.05
Romance $5.00
Sci-Fi $15.00
Technical $20.00
Romance $19.99
Sci-Fi $10.99
Table2 : END RESULT I NEED
Field: Book Categories Book Purchases
Fiction $40.02
Sci-Fi $25.99
Romance $24.99
Technical $20.00
Table1: THIS IS WHAT I HAVE
Field: Book Categories Book Purchases
Fiction $30.02
Fiction $10.05
Romance $5.00
Sci-Fi $15.00
Technical $20.00
Romance $19.99
Sci-Fi $10.99
Table2 : END RESULT I NEED
Field: Book Categories Book Purchases
Fiction $40.02
Sci-Fi $25.99
Romance $24.99
Technical $20.00
Sorry, should be:
1. I would recommend not creating your table, BECAUSE the values change.
1. I would recommend not creating your table, BECAUSE the values change.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks guys! I got how to make the table, but how do I get the total cost to appear in the second column (As described above) Doing it in query form would be fine if you can do it.
SELECT Table1.[Book Categories], Sum(Table1.[Book Purchases]) AS [Total Cost] INTO Table2
FROM Table1
GROUP BY Table1.[Book Categories];
Cheers
FROM Table1
GROUP BY Table1.[Book Categories];
Cheers
ASKER
Oh yeah sorry idun! you explained that in your earlier post.
Thanks again!!!
Thanks again!!!
1. I would recommend not creating your table, but the values change.
2. What you want is already available through grouping and summary on a Report.
3. Also, you could get these totals from a query.
Imoutwest