Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Calculating a date (Access97)

    I have a form called Date_frm. On this form are 2 fields FirstDate and EndDate. What I would like to do is have the user enter into the Firstdate field the first day of the month ie:10/01/02. Them I would like for them to press a button and have the EndDate field calculate what the last day of the date entered into the FirstDate field is. Ie: 10/31/02. Does any know how to do this? Thanks..

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

    Re: Calculating a date (Access97)

    There are several ways to do this.

    You could use the following expression as Control Source for the EndDate text box:

    =DateSerial(Year([FirstDate]), Month([FirstDate]) + 1, 0)

    If you're going to use this kind of formula a lot, you might create a user defined function in a standard module:

    Public Function EndOfMonth(d)
    If IsDate(d) Then
    EndOfMonth = DateSerial(Year(d), Month(d) + 1, 0)
    End If
    End Function

    and use it in the Control Source as

    =EndOfMonth([FirstDate])

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calculating a date (Access97)

    Thanks worked great...

Posting Permissions

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