Subtotal in queries using Access 2003

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • eskelies
    New Member
    • May 2007
    • 55

    Subtotal in queries using Access 2003

    Hello all,

    Does anyone have any code that will subtotal a query in Access?

    Thank you.
    BEFORE:

    Account Code Principal Income
    4 BUY $10.00 $0.00
    4 BUY $10.00 $0.00
    4 BUY $10.00 $0.00
    4 BUY $10.00 $0.00
    5 BUY $10.00 $0.00
    5 BUY $10.00 $0.00
    5 BUY $10.00 $0.00
    5 BUY $10.00 $0.00
    5 BUY $10.00 $0.00
    4 Sell $5.00 $613.89
    4 Sell $5.00 $4,472.22
    4 Sell $5.00 $0.00
    4 Sell $5.00 $0.00
    4 Sell $5.00 $0.00
    5 Sell $151.00 $6,666.67
    5 Sell $15.00 $0.00
    5 Sell $23.00 $10,000.00
    5 Sell $44.00 $16,808.36
    5 Sell $55.00 $15,694.44



    I want my data to look like this:

    Account Code Principal Income
    4 BUY $10.00 $0.00
    4 BUY $10.00 $0.00
    4 BUY $10.00 $0.00
    4 BUY $10.00 $0.00
    4 Subtotal $40.00 $0.00
    5 BUY $10.00 $0.00
    5 BUY $10.00 $0.00
    5 BUY $10.00 $0.00
    5 BUY $10.00 $0.00
    5 BUY $10.00 $0.00
    5 Subtotal $130.00 $0.00
    4 Sell $5.00 $613.89
    4 Sell $5.00 $4,472.22
    4 Sell $5.00 $0.00
    4 Sell $5.00 $0.00
    4 Sell $5.00 $0.00
    4 Subtotal $25.00 $5,086.11
    5 Sell $151.00 $6,666.67
    5 Sell $15.00 $0.00
    5 Sell $23.00 $10,000.00
    5 Sell $44.00 $16,808.36
    5 Sell $55.00 $15,694.44
    5 Subtotal $338.00 $59,341.69
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    Hi. Access reports will do what you ask in the format you require, which is

    Acc 1 detail 1
    Acc 1 detail 2
    Acc 1 detail 3
    Acc 1 subtotal

    Acc 2 detail 1
    Acc 2 detail 2
    Acc 2 subtotal

    and so on.

    You would group the data by account code, show the individual rows in the detail section of the report, and place totals in the group footer.

    A basic report can be created using the report wizard and customised to your requirements thereafter.

    -Stewart

    Comment

    Working...