Computer Learning Zone CLZ Access Excel Word Windows

When I first looked back at the Earth, standing on the Moon, I cried.

-Alan Shepard
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Tip: Birthdays in July    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
A Question about DatePart
Don Gregory 
      
3 years ago
I am having trouble understanding how datepart works as selection criteria when it comes to Access queries and forms. Basically, I have a query that captures all of the volunteer's work schedules. What I want to do is allow the user to input a date and for the form to display all of the work schedules for the week in which the date falls. Here is the query:

SELECT DatePart("ww",[WorkDate],1,3) AS WeekNo, tbl_Work_Schedule.WorkDate, tbl_Work_Schedule.Volunteer_ID, tbl_Volunteers.LastName, tbl_Volunteers.FirstName, tbl_Work_Schedule.Work_Location, tbl_Work_Schedule.Hours_Worked, [LastName] & ", " & [FirstName] AS VolunteerName
FROM tbl_Volunteers INNER JOIN tbl_Work_Schedule ON tbl_Volunteers.ID = tbl_Work_Schedule.Volunteer_ID
WHERE (((DatePart("ww",[WorkDate],1,3))=DatePart("ww",[forms]![frm_Work_Schedules]![WeekDate],1,3)))
ORDER BY tbl_Work_Schedule.WorkDate, [LastName] & ", " & [FirstName];

Interestingly, I can run the query outside of the form by entering a parameter for "WeekDate" when prompted and I get records. But the query doesn't display records when it is the record source for the form.
Other than making the user input a date range, how can I get the form to display the records for the week? What am I doing wrong???
Kevin Robertson  @Reply  
           
3 years ago
In the On Load event of the form add Me.Requery.
Don Gregory OP  @Reply  
      
3 years ago
I ended up using a date range instead and that works out better for the end user, but I think you are right-- I forgot to use Me.Requery. Thank you!

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Tip: Birthdays in July.
 

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: 6/17/2026 12:13:51 PM. PLT: 1s