【发布时间】:2013-12-14 18:35:41
【问题描述】:
我有两个带有两个不同日期的文本框,orderDate 和 recievedDate。收到的日期需要手动输入到表单中,我想包括在 orderDate 之后应该发生的验证,我已经尝试过:
If txtRecievedDate.Text < txtOrderDate.Text Then
MsgBox "Incorrect Date, item can't be recieved before order"
else
MsgBox "correct date"
End If
这不起作用,例如 RecievedDate 值为“19/11/2013”,OrderDate 值为“20/10/2013”,尽管这将是正确的日期,但此语句仅比较“19”和“20” "因此将其标记为不正确。
有没有办法在文本框中比较两个日期?为此我使用 VBA
谢谢
【问题讨论】:
-
为什么使用文本框输入日期?见THIS
标签: vba