Access 2007-2019 Access 2000-2003 Access Seminars TechHelp Support Tips & Tricks Access Forum Course Index Topic Glossary Insider Circle

 Home   Courses   Seminars   Templates   Help   TechHelp   Forums   Contact   Join   Order   Logon More... What's New? Popular Links ------------ Access Courses Access Index Access TechHelp Access Forum ------------ Excel Courses Excel Index ------------ Code Vault Testimonials

Access: Calculate 2nd Monday in January
By Richard Rost     13 years ago

Q: My amateur association keeps a diary of future events. Some of these are booked as, say, "Saturday in week 23 of each year" or "Second Thursday in May of each year". For a particular year, how do I convert these into dd/mm/yy? -Alan

A: You're going to have to approach each of these on a case-by-case situation, and it's probably going to involve some programming with loops. Microsoft Outlook handles dates like this.

For example, to find the 2nd Monday of January 2008, you'd have to set up a loop like this:

' NumMondays = 0
' d = #1/1/2008#
' While NumMondays < 2
' If Weekday(d) = 2 Then '2=Monday
' NumMondays = NumMondays + 1
' End If
' d = d + 1
' Wend
' d = d - 1
' MsgBox d

When you're done, you should have your 2nd Monday. Of course, you can manipulate the dates to search for any month, or even build this into a function so you can send it a month and year, and all that jazz... but this should get you started.

Start a NEW Conversation
 Only students may post right now. Click here for more information on how you can set up an account. If you are a student, please LOG ON first.

 You may want to read these articles from the 599CD News:
 12/4/2021 Hangman! 12/3/2021 Access Beginner 2 12/3/2021 Access Beginner 2 Lessons 12/3/2021 Access Beginner 2 11/30/2021 Import Multiline Cells 11/30/2021 Adam's Access Games 11/29/2021 Prevent Close 11/28/2021 Random 11/22/2021 Currency Symbols 11/13/2021 Access Developer 36

 Learn  Access - index Excel - index Word - index Windows - index PowerPoint - index Photoshop - index Visual Basic - index ASP - index Seminars More... Customers  Account Login Online Theater Downloads 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 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 Email Richard Mailing Address Phone Number Fax Number Course Survey
Keywords: access date dates tips  PermaLink