Results 1 to 13 of 13
  1. #1
    atisz is offline Novice
    Windows XP Access 2000
    Join Date
    Jun 2011
    Location
    Romania
    Posts
    2

    Cash Book balance calculation help needed

    Hi guys!

    I have a cash book application developed in MS Access 2000 which works great the way it was designed, with stored previous balance and current balance, but now for the simplicity of data input and correcting mistakes, my client would like the application to calculate balance on the fly. I tried to figure out how to do this but unfortunately I couldn't get any results on displaying the correct previous and current balance for a certain date or for a longer time (for 1 week, 2 months, etc.) on a day by day basis. My cash book table contains more than 1 record/date, this is what make it impossible for me to calculate the balance. I need to display balance only on reports.


    This is my table:

    tblCashBook
    ---------------
    Id
    Date
    Document_nr
    Explanations
    Receipts
    Payments

    To understand more clearly what I mean, I attach a DB containing the above table.
    Using this table I have to group stored information by date and do the necessary calculations in order to obtain the balance. But how?

    Any help appreciated.

    Attila

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536

  3. #3
    jgelpi16 is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Mar 2010
    Location
    Charlotte, NC
    Posts
    544
    Not to pick apart your design, but why do you have " lei" after your receipts and payments values? I would split that value out into a separate column maybe? Here is a formula that I use a lot when messing with dates. At it's current configuration it returns anything for last week. This may be a start to help you tell it which dates to use.

    Code:
    Format((Date()-7)-Weekday(Date()-7)+7,"mm/dd/yyyy")

  4. #4
    evander is offline Competent Performer
    Windows 7 Access 2003
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    206

    UNION query for beginning balances and transactions

    Hm... accounting stuff. Maybe I can help a little bit. I included few queries, a form, and a report in the database you uploaded.

    The solution is to create two separate queries: one for creating a single amount of beginning balance, and another to display transactions starting from the date of the beginning balance.

    Hope this helps, and good luck from here.

  5. #5
    evander is offline Competent Performer
    Windows 7 Access 2003
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    206
    Oh, and I forgot. In the report, there's a textbox that displays the difference of Receipts and Payments. Set the Running Sum property of this textbox to Over All.

  6. #6
    atisz is offline Novice
    Windows XP Access 2000
    Join Date
    Jun 2011
    Location
    Romania
    Posts
    2
    Quote Originally Posted by evander View Post
    Hm... accounting stuff. Maybe I can help a little bit. I included few queries, a form, and a report in the database you uploaded.

    The solution is to create two separate queries: one for creating a single amount of beginning balance, and another to display transactions starting from the date of the beginning balance.

    Hope this helps, and good luck from here.
    Great job Evander! Thank you so much for helping me out on this. However, there was a small problem which led to a huge error in final balance. If I had set SartDate to 1st may 2011 (which is the date since I keep the track of cash book with this application) and EndDate to any later date that exist in tblCashBook, the resulting balance was correct. But if I had set StartDate to any other later date different from 1st may 2011, the balance wasn't correct anymore, because Beginning Balance took the value of StartDay final balance, and this produced some smaller or bigger differences on each day, and of course, EndDay balance.
    So I started to write this post wishing to ask your help to fix the problem, but suddenly I realized fixing was very simple: I just head to change <=[Forms]![frmMain]![txtStartDate] to <[Forms]![frmMain]![txtStartDate] in qryBeginning, and voila! It's working great!
    Thanks again for your help Evander, I have to put everything into the right place to get the desired design and I'm going to post here the result, maybe it will be useful for others too.

    Attila

  7. #7
    evander is offline Competent Performer
    Windows 7 Access 2003
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    206
    You're right. The startday criteria should be "less than." You're welcome Attila. Glad I can help.


    Jan

  8. #8
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    Evander;
    Thanks also. I have amended my check book to reflect your changes. I noted however that there was no sorting in either the report or the queries. Did I miss something? I added a sort on transaction date to the report.

    Alan

  9. #9
    evander is offline Competent Performer
    Windows 7 Access 2003
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    206
    To Alan Sidman:

    No, you didn't miss anything. Access can get a little tricky sometimes.

    Although you can sort your table records by creating a query, I observed that rows are properly sorted in reports by using the Group and Sort command. In Access 2003 or earlier, the dialog box for Group and Sort shows up by pressing Alt+VS.

    For the sample database in this thread, you can sort by either ID or Date. Sorting by ID puts the beginning balance (with a false ID of 0) at the very top of the table rows.

  10. #10
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    Evander;
    Clearly understand all that. The OP was satisfied with the results yet had not made any comment regarding the sort presentation so I thought maybe I had missed something. Thanks again. I really liked the idea of the beginning balance query and follow up with the Union. I had done similar approaches on other db, but it just never occurred to me to do it in this one.
    Alan

  11. #11
    evander is offline Competent Performer
    Windows 7 Access 2003
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    206
    I like using UNION queries myself. As an accountant, I find it quite useful in creating ledgers with beginning balances, and also in creating automated journal entries. It's great to know you liked the idea too.

    Can I add you in my friends list?
    Thanks a lot, Alan.

    Jan

  12. #12
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    Jan
    Send the invite. My background is also Finance and Accounting but mostly retired now.
    Alan

  13. #13
    evander is offline Competent Performer
    Windows 7 Access 2003
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    206
    Oh, you're into finance. What a coincidence. I sent the invite a few minutes ago. Kindly confirm it. Thanks.

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

Similar Threads

  1. Replies: 4
    Last Post: 08-19-2011, 01:53 PM
  2. ATM Cash Management System
    By NexusMike in forum Access
    Replies: 1
    Last Post: 08-09-2010, 12:48 AM
  3. I want MSN appear when I am out of balance
    By miziri in forum Programming
    Replies: 4
    Last Post: 06-20-2010, 02:53 AM
  4. Condiation in balance not less than zero
    By miziri in forum Programming
    Replies: 0
    Last Post: 05-24-2010, 08:21 AM
  5. help needed with a query calculation
    By ginglis in forum Queries
    Replies: 1
    Last Post: 04-14-2010, 10:36 AM

Tags for this Thread

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