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 
Access 2007 Report AfterUpdate calculation
Diana 

16 years ago
Hi Richard,

My report is grouped by YEARMONTH and then by JOBTYPE.
YEARMONTH is numeric and JOBTYPE is text. Details are hidden as they number in the hundreds.

I have a query that is to run after the user chooses a date from a combo box.  The combo box is called SelectYearMonth and is populated by YEARMONTH in HBELP_FINAL_Q.  This part works great.

Once the YEARMONTH is selected, I need to calculate the total Pages for each JOBTYPE for the chosen YEARMONTH.  There are four JOBTYPES and the types appear on the report correctly.

Here is where I run into problems, how to calculate the page totals for the YEARMONTH selected by the user by JOBTYPE. The total is to be displayed in a text box called TotalPagesTextbox that I have in the JOBTYPE footer. The AfterUpdate() code I am trying to use is:

Me.TotalPagesTextbox = DSum("Pages", "HBELP_FINAL_Q", "YEARMONTH = " & [SelectYearMonth] & "' AND JOBTYPE = '" & Me.[JOBTYPE] & "'")

I know there is something I am missing in the syntax here.

Can you please help?

Thanks,
Diana
 


Answer from Richard Rost:

If YearMonth is an unbound combobox on your form, it might still be returning a TEXT value which could throw off your Dsum. Try using

CLng(SelectYearMonth)

in your Dsum statement to convert that value to a number (long) beforehand… unless the data is stored as TEXT in your table, in which case don't convert it and put quotes around it instead (like you did with JobType).

Also, what is exactly is "Pages"? Is that also a field in your query? It would have to be to use the Dsum function to add them up. If you're trying to calculate the actual number of PRINTED pages in your report, that's a whole different monster - and you won't be able to use Dsum to do that.

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/22/2026 1:16:54 PM. PLT: 2s