If [Due_date] < (Date - 1826) Then
j = (MsgBox("This invoice is long overdue, isn't it. Is it correct?
Do you want to save it?", vbYesNo, "Due date < 5 yrs from Today")) = 7
If j = -1 Then DoCmd.GoToControl ("Due_date"): GoTo 9999
何时j将具有-1值。 我试着去寻找每一个地方,但却找不到它。
答案 0 :(得分:0)
你应该坚持常数 - 并为了可读性而重写一点:
If [Due_date] < DateAdd("yyyy", -5, Date) Then
If MsgBox("This invoice is long overdue, isn't it. Is it correct? Do you want to save it?", vbQuestion + vbYesNo, "Due date < 5 yrs from Today") = vbNo Then
DoCmd.GoToControl "Due_date"
Else
GoTo 9999
End If
End If