Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Sep 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    181
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Date Calculation (Access 2002)

    Hi

    A quick search of this forum and other sites, does not seem to answer this slight variation on a date calculation I require. I have public holiday that falls on 25 October every year. However, the actual day observed for the holiday is the nearest Monday to the 25th. So I need to determine the actual date the holiday is observed (which may well be the 25th for some years) for any particular year.

    So far I haven't been able to think of a solution and would appreciate some advice on the matter.

    Thanks & Regards

    WTH

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Date Calculation (Access 2002)

    The following function (put in a standard module) will calculate the nearest Monday for any given date:

    Public Function NearestMonday(aDate As Date) As Date
    NearestMonday = aDate + 4 - Weekday(aDate, vbFriday)
    End Function

    The nearest Monday to 25-Oct-2005 is NearestMonday(#10/25/2005#)

  3. #3
    2 Star Lounger
    Join Date
    Sep 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    181
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Calculation (Access 2002)

    Hi Hans

    As usual a speedy and great solution saving me heaps of time.

    Many thanks

    WTH

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •