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 Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Update Total Values
Walter Hamilton 
    
5 years ago
I have a form with a subform that I'm filtering using a series of buttons for D-30, D-60, etc.  The form filters fine with the current VBA code I'm using.  The issue is I'm trying to add total fields at the type that I want to be dynamic.  I have a total of five fields that need to update depending on what is displayed in the subform.  I can get it to update based off of one or the other criteria but not both.  the two status that work are:

cUAS_Total.Value = DSum("[Total Value]", "[qry_ChargeCodes_Calculated2]", "[Directorate_ID]= 2")

and

cUAS_Total.Value = DSum("[Total Value]", "[qry_ChargeCodes_Calculated2]", "qry_ChargeCodes_Calculated.[PoP End] Between Date() and Date()+30")

I've tried every combination I can think of for expanding the DSUM statement for both criteria but it isn't working.

I've also tried wrapping  one of the DSUM statements in an IIf statement.

Please advise!
Richard Rost  @Reply  
          
5 years ago
I know this might sound crazy, but don't use VBA and DSUM. Just put =SUM(FieldName) text boxes in the form footer. See Form Footer Totals.
Walter Hamilton OP  @Reply  
    
5 years ago
Richard - Thanks.  That just made things a LOT EASIER!
Richard Rost  @Reply  
          
5 years ago
That's what I'm here for. Occam's Razor... Sometimes the simplest solution is the right one.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access 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/2/2026 7:17:26 AM. PLT: 0s