What is wrong with this code, is won't verify the date entered correctly?
txtCheckInDate is an unbound field
Ian
Private Sub txtCheckInDate_LostFocus()
'Validate data entered'
If txtCheckInDate.Value < Date Then
MsgBox "The arrival date must be today or later!"
txtCheckInDate = Date
txtCheckOutDate.SetFocus
txtCheckInDate.SetFocus
Else
If txtCheckInDate.Value > Date + 365 Then
MsgBox "Bookings are only taken for 1 year or less"
txtCheckInDate = Date
txtCheckOutDate.SetFocus
txtCheckInDate.SetFocus
Else
If IsNull(txtCheckInDate) Then
MsgBox "You must enter a date"
txtCheckOutDate.SetFocus
txtCheckInDate = Date
txtCheckInDate.SetFocus
Else
txtCheckOutDate.SetFocus
Exit Sub
End If
End If
End If
End Sub
txtCheckInDate is an unbound field
Ian
Private Sub txtCheckInDate_LostFocus()
'Validate data entered'
If txtCheckInDate.Value < Date Then
MsgBox "The arrival date must be today or later!"
txtCheckInDate = Date
txtCheckOutDate.SetFocus
txtCheckInDate.SetFocus
Else
If txtCheckInDate.Value > Date + 365 Then
MsgBox "Bookings are only taken for 1 year or less"
txtCheckInDate = Date
txtCheckOutDate.SetFocus
txtCheckInDate.SetFocus
Else
If IsNull(txtCheckInDate) Then
MsgBox "You must enter a date"
txtCheckOutDate.SetFocus
txtCheckInDate = Date
txtCheckInDate.SetFocus
Else
txtCheckOutDate.SetFocus
Exit Sub
End If
End If
End If
End Sub