Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Help   Contact   Merch   Join   Order   Logon   Forums   
 
Home > Forums > Access Forum > Show Hours Record By by James Hopkins
Back to Access Forum    Comments List
Upload Images | @Reply | Bookmark | Link | Email | Next Unseen |
Show Hours Record By
James Hopkins 
     
3 years ago
Hey Guys, I have created a Query to show  the Hours by Equipment and one to show the  Hours by Employee. I created an Aggregate Query, but I can seem to figure out how to the Queries to show the Fields that I need.
Kevin Yip  @Reply  
     
3 years ago
Your query may have columns that shouldn't be included.  If you need to aggregate the hours based on equipment, the aggregate query should essentially have only two columns: equipment and hours.  E.g.:

    SELECT Equipment, Sum(Hours) FROM MyTable GROUP BY Equipment;

An aggregate query should only have group-by field(s) and summation field(s).  Any other columns you put in would affect the result.
James Hopkins OP  @Reply  
     
3 years ago
Thanks Kevin, the for the help, the SQL Code work perfectly. But I have "EmployeeID" and "CrewID" saved in the Table. I keep getting an #ERROR in the Continuous Form.
James Hopkins OP  @Reply  
     
3 years ago

James Hopkins OP  @Reply  
     
3 years ago

James Hopkins OP  @Reply  
     
3 years ago

James Hopkins OP  @Reply  
     
3 years ago

Kevin Yip  @Reply  
     
3 years ago
What are the control sources of the textboxes that get the error?  An #Error occurs when an expression cannot be evaluated correctly.

Is that SQL used for the form's recordsource?  If so, where does the column "# of Entries" get its data?  The SQL only has two columns.
James Hopkins OP  @Reply  
     
3 years ago
Hey Kevin,  the Control Sources of the TextBox of "Employee" is coming for the "EmployeeNameQ": =Nz(DLookUp("EmployeeFullName","EmployeeNameQ","EmployeeID=" & [EmployeeID]),0). The Control Sources of the TextBox of "# of Entries" is coming for: =DCount("HoursLogID","HoursLogT","EmployeeID"), but I got that Corrected.
Kevin Yip  @Reply  
     
3 years ago
Hi James,

The #Error under CrewID is likely due to DLookup returning an error.  Could [EmployeeID] be Null?  That would cause an error, because a Null in [EmployeeID] would cause a syntax error in the criteria: DLookUp("EmployeeFullName","EmployeeNameQ","EmployeeID=")

What is the control source of the textbox for the "Total Hrs. Used" column?

Besides fixing these #Error, you many need to consider design changes.  Ideally, the textboxes' control sources should just be the column names of the form's recordsource's query.  All the aggregations can be done in that query alone, and they don't need to be done a second time in the textboxes' control sources with DLookup, DCount, etc.
James Hopkins OP  @Reply  
     
3 years ago
Hey Kevin, I find out what I did wrong. Thanks for the help on this Problem. Thanks again for helping me through it.

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

Next Unseen

 
 
What's This?

 

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: 11/15/2026 4:06:43 AM. PLT: 1s