我试图阻止用户在用户窗体顶部的文本框中输入早于今天日期的生效日期。
这里的逻辑似乎很合适,但即使日期在今天之后,我也会得到 msgbox。
Private Sub txtEffective_Date_Change()
If IsDate(txtEffective_Date) Then
If cdate(txtEffective_Date) < Date Then
MsgBox "Date chosen is prior to today's date"
End If
End If
End Sub
我认为这与cdatevs.有关date,但不完全确定这里出了什么问题。
