Results 1 to 3 of 3
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Detecting the last day of the month (2003)

    If I use in code a variable, let's call it CalDay, which stores the day selected on a calendar on a form, how can I determine if the day selected is the last day of the month?

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

    Re: Detecting the last day of the month (2003)

    The date of the last day of the month of CalDay is the 0-th day of the next month:

    DateSerial(Year(CalDay), Month(CalDay) + 1, 0)

    So you can test like this:

    If CalDay = DateSerial(Year(CalDay), Month(CalDay) + 1, 0) Then
    ...
    Else
    ...
    End If

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Detecting the last day of the month (2003)

    Thank you Hans <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

Posting Permissions

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