hello there, my project is done...just noticed that my dates are not comparing properly ... it's working only if the year of returned date is less than the year of takeout date ... help me pleaaaasee =)
note: i divided the dates into 3 parts
e.g.:
takeoutday, takeoutmonth and takeoutyear
returnedday, returnedmonth and returnedyear
note: i divided the dates into 3 parts
e.g.:
takeoutday, takeoutmonth and takeoutyear
returnedday, returnedmonth and returnedyear
Code:
Private Sub txtReturnedYear_AfterUpdate() Dim tDate As String Dim rDate As String tDate = Format(Me.cmbTakeOutDay & "/" & Me.cmbTakeOutMonth & "/" & Me.txtTakeOutYear, "dd/mm/yyyy") rDate = Format(Me.cmbReturnedDay & "/" & Me.cmbReturnedMonth & "/" & Me.txtReturnedYear, "dd/mm/yyyy") If CDate(rDate) < CDate(tDate) Then MsgBox "Please change return date!" Me.cmbReturnedDay.Value = "" Me.cmbReturnedMonth.Value = "" Me.txtReturnedYear.Value = "" Me.cmbReturnedDay.SetFocus Else Me.txtReturnedYear.SetFocus End If Me.cmdClearReturnedDates.Enabled = True End Sub
Comment