Results 1 to 6 of 6
  1. #1
    Ashik2020 is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2020
    Posts
    6

    Question Please anyone help me to write my desired query as per Sample Output

    I have a table in MS access (2016 version) name Transaction Table, given following:
    Transaction Table
    ID Transaction Date Receive Payment
    1 01-Mar-20 50
    1 02-Mar-20 40 70
    2 03-Mar-20 400 100
    2 04-Mar-20 300 400
    3 05-Mar-20 500 0
    3 06-Mar-20 200 0
    1 07-Mar-20 476 300
    2 08-Mar-20 390 300
    1 09-Mar-20 0 500
    2 10-Mar-20 300 0
    2 11-Mar-20 0 500
    3 07-Mar-20 500 400
    3 08-Mar-20 200
    Now, I want to write a query (in SQL view window) or want to design a query through MS Access query design wizard which will generate a report containing ID wise Sub total, Running total and grand total from the above table ( sample output is given later). I know that It can be done through MS Access Report wizard but I do not want that , I just want to write a query (using rollup, cube, running total query etc ) like the way it is usually done in Oracle / MS sql server/My sql type of DBMS . Please anyone help me to write my desired query as following:
    Customer Ledger Statement Balance Report
    ID Transaction Date Receive Payment Closing Balance
    1 01-Mar-20 50 50
    02-Mar-20 40 70 20
    07-Mar-20 476 300 196
    09-Mar-20 0 500 -304
    Total 566 870 -304
    2 03-Mar-20 400 100 300
    04-Mar-20 300 400 200
    08-Mar-20 390 300 290
    10-Mar-20 300 0 590
    11-Mar-20 0 500 90
    Total 1390 1300 90
    3 05-Mar-20 500 0 500
    06-Mar-20 200 0 700
    07-Mar-20 500 400 800
    08-Mar-20 200 600
    Total 1200 600 600
    Grand Total 2656 2170 486
    Thanks In Advance !!


    Regards
    Ashik

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    1.You can do this as a report,since queries don't work this way.
    2. You can produce the base query,then put it in Excel to produce the sub totals.

  3. #3
    Ashik2020 is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2020
    Posts
    6
    Sir,
    I dont think so....at least the below output is possible in MS access, as far I know:

    ID Transacition Date Receive Payment
    1 01-Mar-20 50
    02-Mar-20 40 70
    07-Mar-20 476 300
    09-Mar-20 0 500
    Total 566 870
    2 03-Mar-20 400 100
    04-Mar-20 300 400
    08-Mar-20 390 300
    10-Mar-20 300 0
    11-Mar-20 0 500
    Total 1390 1300
    3 05-Mar-20 500 0
    06-Mar-20 200 0
    07-Mar-20 500 400
    08-Mar-20 200
    Total 1200 600
    Grand Total 2656 2170
    Anyone else here, who can help me?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    It can be done, it's just much easier on a report. Basically you use a UNION query that pulls together the detail in one section and the group totals in another.

    Searching on running sum should turn up methods to do that.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Ashik2020 is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2020
    Posts
    6
    OK then, can you write down the query here for me?

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 01-31-2020, 02:19 PM
  2. Desired Numerical Format in Query!
    By cap.zadi in forum Queries
    Replies: 2
    Last Post: 11-22-2018, 05:32 AM
  3. Replies: 6
    Last Post: 03-01-2018, 03:55 AM
  4. Query not producing the desired data
    By WAVP375 in forum Access
    Replies: 7
    Last Post: 01-14-2016, 02:18 PM
  5. Replies: 4
    Last Post: 10-03-2010, 09:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums