-
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
-
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())
-
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.