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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reports on table with multiple pages of entries 1

Status
Not open for further replies.

SGBG

Programmer
Feb 20, 2003
2
US
I have a rather large table 52000+ records with only a few fields. The table includes data for 150 customer branches.
Relevant Fields are BranchID, SubClass, Description, Amount, LineReference.
I want my report organized by BranchID, then by subClass.
For each of the subclass entries, I want the report to have a column for different descriptions.
Sample of how the data is organized:
BranchID SubClass Description Amount LineRef
1 s1 Charges 100.00 1030
1 s1 Refunds 50.00 1050
1 s1 Misc 10.00 1060
1 s2 Charges 99.00 1030
1 s2 Refunds 98.00 1050
1 S2 Misc 55.00 1060
2 s1 Charges 150.00 1030
2 s2 Refunds 55.00 1050
What I want:
BranchID 1
SubClass Charges Refunds
S1 100.00 50.00
S2 99.00 98.00
I have tried using VBA code to create another table and to populate that table, it works, but is very slow.
 
Try a cross tab query:

TRANSFORM Sum(TableName.Amount) AS [The Value]
SELECT TableName.BranchID, TableName.SubClass, Sum(TableName.Amount) AS [Total Of Amount]
FROM TableName
GROUP BY TableName.BranchID, TableName.SubClass
PIVOT TableName.Description;


Let me know if this helps.

BAKEMAN [pimp]
 
I think this will do very well. Kudos and thanks BAKEMAN.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top