Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Developer Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
How to Sum a Field with No Detail Lines
Gary Becker 
     
2 months ago
In my GLTransactionF, I set the beginning and ending dates and the GL account number and an AfterUpdate event calculates the beginning value. The detail section has the activity between the dates and the SUM in the detail form footer adds up the values in the detail lines. The Ending Balance is the sum of the Beginning balance and the totals from the detail line items. BUT if there aren't any detail lines, then my totals in the footer are blank and my Ending Balance is blank. I've used NZ in the formulas.
Gary Becker OP  @Reply  
     
2 months ago

Gary Becker OP  @Reply  
     
2 months ago

Kevin Robertson  @Reply  
          
2 months ago
Give this a go.

=IIf(Count([Debit])>0,[BeginningBalance]+Sum([Debit]),[BeginningBalance])

IIF Function
Gary Becker OP  @Reply  
     
2 months ago
I could not get that IIF to work, but it got me to thinking. Here is what seems to work so far.
Gary Becker OP  @Reply  
     
2 months ago

Gary Becker OP  @Reply  
     
2 months ago
I have a sub called UpdateForm() that sets the form's recordset and does some dLookups to get the BeginningBalance, etc. I added this block of code at the bottom of the sub to set the EndingBalance with VBA. So far (fingers crossed) it seems to work.
Thomas Gonder  @Reply  
      
2 months ago
Gary Depending on what kind of account it is, wouldn't a debit or credit be negative? Or are they already signed?

It's been 40 years since I wrote my last GL module. If I recall correctly, I kept positive numbers in both the Db and Cr fields. Each GL account was assigned a "type" of: asset, liab, cap, inc, exp, close. There may have been more, I just don't recall all the particulars after 40 years. That type assignment determined what increased or decreased the balance of that account. Do people/students still use T-accounts?
Gary Becker OP  @Reply  
     
2 months ago
Thomas, in our system the debits are positive numbers and the credits are negative numbers. Some people says: Debits on the left, credits on the right. But in our system, you can have credits on the left, too, as negative numbers. So, in our system, debits are positive and credits are negative. If they are in the wrong column, I guess you could say they are negative debits or negative credits. I am pulling the data from our accounting software (Sage CRE 300) into Access because it is so much friendlier to work with.
Thomas Gonder  @Reply  
      
2 months ago
So, since assets = liabilities + capital (the basic accounting equation) all your liabilities and capital accounts are normally negative numbers? That will make for an interesting balance sheet!

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 7:44:53 AM. PLT: 0s