Results 1 to 3 of 3
  1. #1
    rjbautista20 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jan 2012
    Posts
    23

    Getting First monday,tuesday etc and every 15 and 30 of the month

    Hi guys,



    please help me again in getting the result of Frist Monday,Tuesday, Wednesday, Thursday, Friday of the month


    and i want also to get the date of every 15 and 30 of the month.

    Please help.

    Thanks.

  2. #2
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Here's a routine :

    Public Function FirstMonday(TheDate)

    Dim WhatDate As Date, DayNum As Integer

    DayNum = 1

    Do Until DayNum > 7
    WhatDate = CDate(Format(TheDate, "mm") & "/" & DayNum & "/" & Format(TheDate, "yyyy"))
    If DatePart("w", WhatDate) = 2 Then Exit Do
    DayNum = DayNum + 1
    Loop

    FirstMonday = WhatDate

    End Function

    To use it in a query:
    Mond:FirstMonday(datefieldname)
    Tues:FirstMonday(datefieldname)+1
    etc

    for the 15th and 30th you would use :
    CDate(Format(TheDate, "mm") & "/15/" & Format(TheDate, "yyyy"))

    The format of the date is American - change it to your way if different.

  3. #3
    rjbautista20 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jan 2012
    Posts
    23
    @aytee111, thanks for your reply.

    here's my scenario..

    i have 20 different countries that has a lot of windows.

    1st scenario:
    US, every 15 and 30 of the month. if the date falls between 1 to 15 the date should be 15 and between 16 to 30 the date should be 30 and if the month has 31st it should be the next month which 15 in this scenario.

    2nd scenario. some countries has every monday or tuesday etc etc...

    if the date falls on tuesday to sunday it should be the next monday ... etc..

    i hope you understand my explanation.

    thanks again and more power to this forum.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 12-11-2011, 07:16 PM
  2. Replies: 6
    Last Post: 07-17-2011, 06:42 PM
  3. Replies: 5
    Last Post: 11-15-2010, 06:12 PM
  4. Replies: 4
    Last Post: 10-27-2010, 02:57 PM
  5. Replies: 1
    Last Post: 07-27-2010, 09:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums