Specific Dates - Next Monday

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • OllyJ
    New Member
    • Dec 2007
    • 50

    Specific Dates - Next Monday

    Hi there, i hope someone can help me ASAP please.

    I want to show 2 text boxes on a form which indicate next weeks starting date (next monday) and the week afters.

    ie today is 14/12/2007 - i need 'textbox1' to automatically show "Mon 17/12/07" and 'textbox2' to automatically show "Mon 24/12/2007".

    I'd appreciate anyones help on this one, thanks in advance, OllyJ
  • lee123
    Contributor
    • Feb 2007
    • 556

    #2
    hello you could default this by using this:

    Code:
    date()  for textbox 1 and :
    date()+10  in textbox 2
    put these in the default value of the textboxes

    lee123

    Comment

    • FishVal
      Recognized Expert Specialist
      • Jun 2007
      • 2656

      #3
      Something like the following:

      [code=vb]
      DateAdd("d", 8 - Weekday(Date, vbMonday), Date)
      DateAdd("d", 15 - Weekday(Date, vbMonday), Date)
      [/code]

      Regards,
      Fish

      Comment

      • OllyJ
        New Member
        • Dec 2007
        • 50

        #4
        Thank you for your help.

        Fish, your code helped tremendously.

        The final code I used for "next Monday" and "the Monday after" (as it may help someone else out) is.....

        "Next Monday": =DateAdd("d",8-Weekday(Date(), 2),Date())

        "the Monday after": =DateAdd("d",15-Weekday(Date(), 2),Date())

        Thanks again, OllyJ

        Comment

        • FishVal
          Recognized Expert Specialist
          • Jun 2007
          • 2656

          #5
          Glad it has helped you.

          Best regards,
          Fish

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32645

            #6
            Originally posted by FishVal
            Something like the following:

            [code=vb]
            DateAdd("d", 8 - Weekday(Date, vbMonday), Date)
            DateAdd("d", 15 - Weekday(Date, vbMonday), Date)
            [/code]

            Regards,
            Fish
            A perfect answer Fish ;)

            Comment

            • FishVal
              Recognized Expert Specialist
              • Jun 2007
              • 2656

              #7
              Thanks, NeoPa.
              I just like such kind of solutions with "arithmetic al" logic. ;)

              Comment

              Working...