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 Issues
Kim Nielsen 
      
3 years ago
I am trying to build a dashboard with totals based on current year, month, and Quarter. From my query (AllFillCountQ) i have formats where the date is formatted as Month:Format[DateFill],"mmmm") on my dashboard I placed 2 text boxes, 1: Current system month MTD: =Format(Now(),"mmmm"), then the current month sum of events should read 29, in the field called MonthT which has in the control source: =Nz(DSum("Cylinders","AllFillCountQ","Month=""&[MTD]&"""),0) this does not return the correct value. What am i missing in my code? Thank you
Kevin Robertson  @Reply  
           
3 years ago
First thing I notice is you named your calculated field in your Query 'Month'. This is a reserved word. Using it as a field name may cause problems later.

In your formula that isn't working, you are missing a couple of quotes:
=Nz(DSum("Cylinders", "AllFillCountQ", "DateFillMonth=""" & [MTD] & """"),0)
Kim Nielsen OP  @Reply  
      
3 years ago
I changed the "Month" to M2 in the query, and updated the code as specified here. by adding the extra quotes. Now the sum calculates All Months. Such as All the February's into one total instead of Feb 2022 only.  As specified as such: =Nz(DSum("Cylinders","AllFillCountQ","M2="""&[MTD]&""""),0). The value for all year, month and quarter should read 29. As i have only 2 records 26 Feb 2022 = 14(Cylinders), and 27 Feb 2022 = 15(Cylinders). My year works perfectly, still not sure why:  
=Nz(DSum("Cylinders","AllFillCountQ","Year="&[YTD2]),0)  Thank you for your assistance
Kevin Robertson  @Reply  
           
3 years ago
You could write it something like this which would sum up your values for the current month of the current year.
You could replace the Date() function with values from a field on your form.

=Nz(DSum("Cylinders","AllFillCountQ","DateFill=" & Month(Date()) & " And DateFill=" & Year(Date())),0)

Depending on your setup you may be able to replace the query name with the table name eliminating the need for the query.
Kim Nielsen OP  @Reply  
      
3 years ago
Hi Kevin, I believe i have solved the issue. The month and Quarter could not figure out the year in question. For example Feb 2022, The code would select all Feb and calculate totals. So in the Query for M2(month) was formatted with "mmmm, yyyy" vice just "mmmm" , same with the quarter. Then when I applied the following code =Nz(DSum("Cyl2","AllFillCountQ","FillDate="""&[MTD]&""""),0) it would select the correct month from the fields on the form indicating the year, month and quarter. now it will calculate the selected month. To test this I changed my clock to a seperate set of fills, and the all calculated correctly. Thank you for your assistance.

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:22:40 AM. PLT: 1s