Access 2007 calculates the cumulative balance through a query

Source: Internet
Author: User

When accounting staff use manual bookkeeping, there will be a balance after "borrow" and "loan", which is the accumulated balance, that is, after each account is recorded. If you use computer bookkeeping, you can complete the calculation of the accumulated balance by querying.

First, the establishment of the table (assuming the save name is "financial balance"), the table in addition to the date, borrow, credit, summary and other fields, but also add an AutoNumber field "ID." After design, input data.

Second, the establishment of inquiries. Add the necessary fields to the query. Then write an expression in a blank field--Balance: NZ ("borrow", "financial balance", "[Date]<#" & [Date] & "#")) +dsum ("Borrow", "financial balance", "[Date]=#" & [Date] & "# and [id]<=" & [ID])-nz (DSum ("credit", "Financial balance", "[Date]<#" & [Date] & "#")-dsum ("credit", "Financial Accounting"), [Date]=# & [Date] & # and [id]<= & [ID]].

Three, run this query, you can see the "Balance" field and its cumulative balance value.

Description: This query is only suitable for raw table data. If you want to filter in a query, the remaining balance may be problematic.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.