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 
DSum multiple criteria
Alan Higgins 
      
3 years ago
I have an access account database that has 4 accounts with 2 Dsum functions for values. I need to break this account into yearly quarters for each account. I am unable to
set the DSUM function to calculate only on the quarter it is in. The DSUM is populating the fields into all quarters. Is there a way to set the DSum criteria to only look at the quarter selected instead of the entire year. I"ve tried adding a datepart function within the code and the property of the field, no luck.

Below is my working DSum calculation:

Surplus/Receipts: DSum("Receipts","CheckingT","AccountID=" & [AccountID] & " AND CheckID<=" & [CheckID])-DSum("Expense","CheckingT","AccountID=" & [AccountID] & " AND CheckID<=" & [CheckID])
Kevin Robertson  @Reply  
          
3 years ago
Below is a simplified solution that should help you accomplish your goal.
Kevin Robertson  @Reply  
          
3 years ago

Kevin Yip  @Reply  
     
3 years ago
The DatePart() function can return the quarter of a date, so you can use that to your advantage.  For instance, DatePart("q", #1/8/23#) will return 1.
Alan Higgins OP  @Reply  
      
3 years ago

Alan Higgins OP  @Reply  
      
3 years ago

Alan Higgins OP  @Reply  
      
3 years ago
The second image is my original query
Kevin Yip  @Reply  
     
3 years ago
Hi Alan, a few things below pertaining to the first picture you posted:

1.  Int(Month([ChkDate])/4+1) doesn't seem to work.  If ChkDate is in Oct or Nov, it returns 3, but both months are in quarter 4.  Use DatePart("q", [ChkDate]) instead.

2.  Add another column in your query for year, and set it to "Group By".  E.g. Yr: Year([ChkDate]) -- Group By.  The year needs to be part of the grouping, otherwise all the Nth quarters of all the years will be added together.

3.  The InTakeTotal Sum column already gives you the annual quarterly totals.  So you don't need the QuarterTotal column, nor the use of DSum.  What makes it possible to get the quarterly totals is the grouping created by the Yr and Qrt columns.
Alan Higgins OP  @Reply  
      
3 years ago
Kevin's - Thank you both for lending your help. I think i am not explaining the issue plainly enough. The formula above that Kevin Robertson offered works however i need the formula to work as a running balance. My original formula works ( See Examples) however the 2 calculated RunningBalance calculations do not recognize the quarter i selected and pass their values into the next quarter which i do not want. I need a solution to keep the running balance calculations in their selected quarter. All other fields in the query recognize the quarter. For some reason those do not.
Alan Higgins OP  @Reply  
      
3 years ago

Alan Higgins OP  @Reply  
      
3 years ago

Alan Higgins OP  @Reply  
      
3 years ago

Alan Higgins OP  @Reply  
      
3 years ago
The first image is the query i am using where i select quarter and  account. I have the query set to the current year.
Second image is the output which is what i want from my query
Third image is what i get when i tried to add values to the 2nd quarter as you can see is migrating the Runningbalance and Surplus/Receipt outputs from the first quarter when i start to enter data.

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:16:31 AM. PLT: 0s