I have a form with two text fields, txt_FollowUpDate and txt_ApproveDate. In the After Update event of txt_ApproveDate, I placed the code below to check if the date enetred in it is before the follow up date.
If DateDiff("d", Date, [txt_FollowUpDate]) <= 0 Then
Me.txt_ApproveDate = Date
Else
MsgBox "You can not approve the CAR before the follow up is completed.", vbExclamation
Me.txt_ApproveDate = Null
End If
This works great when the date in txt_FollowUpDate is before the Approve Date. However, when txt_FollowUpDate is null, I get the message box message. Shouldn't it still set txt_ApproveDate to Date if txt_FollowUpDate = 0?
If DateDiff("d", Date, [txt_FollowUpDate]) <= 0 Then
Me.txt_ApproveDate = Date
Else
MsgBox "You can not approve the CAR before the follow up is completed.", vbExclamation
Me.txt_ApproveDate = Null
End If
This works great when the date in txt_FollowUpDate is before the Approve Date. However, when txt_FollowUpDate is null, I get the message box message. Shouldn't it still set txt_ApproveDate to Date if txt_FollowUpDate = 0?