Results 1 to 8 of 8
  1. #1
    darshit_goswami is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2015
    Posts
    29

    RunningTotal or Closing balance Issue ( already tried posted solutions )

    Hi friends,

    This is my first post over this forum. I'm a newbie to access world. I m actually trying to make a little database utility to maintain store balance in my school.

    Everything in layout looks great but i m stuck with a problem which i m not able to solve. So here is the problem, i wish u guys will help me sort it out.

    I kept Access2003 format so that it could run in almost all the pcs.

    Here i m not able to get running total / closing balance in tblRegister.

    here r the attached SS.

    Table Designs : tbl_in and tbl_issueClick image for larger version. 

Name:	tbl_in.PNG 
Views:	22 
Size:	4.7 KB 
ID:	19237Click image for larger version. 

Name:	tbl_issue.PNG 
Views:	22 
Size:	5.3 KB 
ID:	19238

    table sample data : Click image for larger version. 

Name:	tbl_in_SampleData.PNG 
Views:	22 
Size:	9.6 KB 
ID:	19239Click image for larger version. 

Name:	tbl_issue_SampleData.PNG 
Views:	22 
Size:	12.6 KB 
ID:	19240

    Make Table query :
    SELECT tbl_issue.srNo, tbl_issue.CrNo, tbl_issue.gprNo, tbl_in.itemName, tbl_in.inQty, tbl_in.inDate, tbl_issue.issueQty, tbl_issue.issueDate, tbl_issue.issuedTo, [inQty]-[issueQty] AS closingBal INTO tblRegister
    FROM tbl_in INNER JOIN tbl_issue ON tbl_in.gprNo = tbl_issue.gprNo;


    tblRegister ( Which I m getting ) Wrone One...
    Click image for larger version. 

Name:	tblRegister.PNG 
Views:	23 
Size:	20.2 KB 
ID:	19241

    Continue in next post...

  2. #2
    darshit_goswami is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2015
    Posts
    29
    tblRegister ( Desired one, which i want to get )

    Click image for larger version. 

Name:	tblRegisterDesired.PNG 
Views:	23 
Size:	19.6 KB 
ID:	19242

    Here is that sample mdb file.db1.mdb

    One Item in tbl_in can be issued to many person with different qty in tbl_issue. All I need is , everytime when an item is issued , it should be deducted from inQty and get a closing balance , and when same item issued again , issueQty should be deducted from closing balance.

    I hope you got my point.


    hope to get some solution..

    If there is any confusion regarding this post. Kindly ask. I can try to explain to my best.

    Thanks in advance.

    Darshit

  3. #3
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    The queries works. db1.zip
    It depends on the field "srNo" on table "table_issue" to be unique (which it should be since it is an autonumber and not to have any duplicate).

    Hope this works for you.

    I'm sure there are other ways to do the same.

  4. #4
    darshit_goswami is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2015
    Posts
    29
    thanks ifpm

    This seems to work on this db. Will implement your given suggestions on main database and will report.

    Thanks for the help ,..

    Regards,
    Darshit

  5. #5
    darshit_goswami is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2015
    Posts
    29
    Bump......

    First of all apologies if I'm violating any forum rule here by bumping the thread. But the question is related to this and instead of starting a new thread i think its better to be asked here only.

    The solution posted above works perfectly. But now my storekeeper asks me to get list of all the records where ClosingBalance > 0 after item issue process is done.

    so the basic idea is, get a gprNo , loop through all records in issuetable with same gprNo. Find last record, get Closingbalance , if its > 0 then display it else move to next gprNo.

    I dont know how to do it... Any help ?

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    So you need to know which grpNo's have a 0 balance? Don't need the running balance for that. Total inQty minus total issueQty should accomplish. Do an aggregate query for each table then join those queries in another query.

    tblIn shows only one record for each grpNo - will there ever be multiple records for each grpNo?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    darshit_goswami is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2015
    Posts
    29
    thanks june for heads up ,..

    I think I'm dumb.. Will try your given solution,...

    gprNo is unique cant be duplicated ever,...

    CrNo is unique too but once the physical register is filled , it can again have same crNo.. but that aint going to happen for next few years and i kept enough place in the field so that in future it can hold numbers for next 9 physical registers to be filled up,.. it will take more then 50 years at current space..

    I m actually developing a small utility for my institute, and it will be free for use for several institutes who fall in same category

    thanks will report u back quickly with inQty - sum (issueQty) formula.

  8. #8
    darshit_goswami is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2015
    Posts
    29
    worked ,..

    Code:
    SELECT qryCR1.gprNo, qryCR1.itemName, qryCR1.itemQty, Sum(qryCR1.outQty) AS SumOfoutQty, [qryCR1]![itemQty]-Sum([qryCR1]![outQty]) AS leftBh
    FROM qryCR1
    GROUP BY qryCR1.gprNo, qryCR1.itemName, qryCR1.itemQty
    HAVING ((([qryCR1]![itemQty]-Sum([qryCR1]![outQty]))<>0));
    where qryCR1 is

    Code:
    SELECT tblCR.srID, tblCR.crNo, tblCR.gprNo, tblGPR.itemName, tblGPR.itemQty, tblItems.itemUnit, tblGPR.inwardDate, tblCR.outDate, tblCR.outQty, tblCR.indentNo, tblCR.indentDate, tblCR.instName, tblInstructors.tradesAssigned
    FROM tblItems INNER JOIN (tblInstructors INNER JOIN (tblGPR INNER JOIN tblCR ON tblGPR.[gprNo] = tblCR.[gprNo]) ON tblInstructors.[instID] = tblCR.[instName]) ON tblItems.itemCode = tblGPR.itemName
    ORDER BY tblCR.srID, tblCR.gprNo;
    qryCR1 may be overkill here but I made that query earlier for some other work ,.. like getting closing balance, and generate report ,.. i picked up fields from there ,..

    I m sure there will be many other ways ... but this one worked for me ,..

    Table names are not as same as posted in db above but most of them can be understood.

    Thanks ,.. marked as solved,..

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

Similar Threads

  1. Replies: 11
    Last Post: 10-22-2014, 07:56 AM
  2. Replies: 3
    Last Post: 04-19-2014, 02:35 AM
  3. Multiuser Access Solutions?
    By GaryE in forum Access
    Replies: 4
    Last Post: 04-16-2013, 06:15 AM
  4. Issue w/ VBA code for Opening/Closing Forms
    By need_help12 in forum Forms
    Replies: 5
    Last Post: 04-20-2012, 11:09 AM
  5. Replies: 1
    Last Post: 01-19-2012, 03:31 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