Same day each month, Access.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • diverman
    New Member
    • Oct 2006
    • 9

    Same day each month, Access.

    I want to add a date into a field then add one month.
    Then show in a text box the result, where the day would be the same.

    ie:- if i put in the date 14/Sep/2006 which is a Thursday add a month and show 12/Oct/2006, which is also a Thursday.

    TIA,
    Gordon.
  • navigator
    New Member
    • Oct 2006
    • 10

    #2
    Originally posted by diverman
    I want to add a date into a field then add one month.
    Then show in a text box the result, where the day would be the same.

    ie:- if i put in the date 14/Sep/2006 which is a Thursday add a month and show 12/Oct/2006, which is also a Thursday.

    TIA,
    Gordon.

    You can achieve this only by adding 4 weeks to the first date. Here's the code


    Date2 = DateAdd( "ww", 4, Date1)

    There might be occasions if Date1 is close to the beginning of the month. This will set Date2 28 days later in the same month. You can check for this by adding the following line that checks the month of both dates and adds another week if required:

    If Month(Date1) = Month(Date2) then Date2 = DateAdd("ww", 1, Date2)


    Hope above is helpful...

    Comment

    Working...