Results 1 to 3 of 3

Thread: Try to answer this Please!

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 1999
    Posts
    184

    Post

    I Wanted to be told by a message box when the date inside a integer is 3 months or more older than the the current date..
    Could someone show me how please??

    Integers

    Intday = Day
    IntMonth = Month
    IntYear = Year

    CurDay = CurrentDay
    Curmonth = Curmoneth
    Curyear = Curyeay

    please Make a msgbox to come up and tell me if the dates are more than 3 months apart??

    Thankyou In advance

    Evan

  2. #2
    Addicted Member
    Join Date
    Jan 2000
    Location
    Oshkosh, WI
    Posts
    163

    Post

    Build a date using your integer variables and then use the dateDiff function to calculate the number of days between the two dates.

    Code:
    ThisDate = cdate(cstr(intmonth) & "/" & cstr(intDay) & "/" cstr(intyear))
    
    NumDays = DateDiff("d",ThisDate,now())

  3. #3
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    Post

    Hi Evan.

    Put a command button on a form and put this code in the click event:
    Code:
    Private Sub Command1_Click()
        Dim myDate As Date
        
        myDate = #12/10/1999#
        
        If DateDiff("d", myDate, Now) > 90 Then
            MsgBox "Date Difference is more than 3 months"
        Else
            MsgBox "Date Difference is less than 3 months"
        End If
    End Sub
    All the best.

Posting Permissions

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



Click Here to Expand Forum to Full Width