I have two dates I would like to compare.
Basically if one date is older than the other date - display an error message
Otherwise, continue on.
I have been doing this for at least two days now (and today is my birthday).
I've been researching the DateDiff function as my other method I was trying didn't work as I wish. Does the DateDiff take the right date from the left date so that in some cases a negative answer might result? If not, I will revert back to the other method I was attempting and try going from that angle......
------------------------------------------
Private Sub injection_due_date_Exit(Cancel As Integer)
TestDate
End Sub
---------------------------------------------
Function TestDate()
Runquery
DoCmd.OpenTable "dobcheck", acNormal
Dim dob
Dim datecheck
If DateDiff("d", dob, datecheck) > 0 Then
MsgBox "Incorrect date!"
Else
DoCmd.close acTable, "dobcheck", acSaveNo
End If
End Function
-------------------------------------------
Sub Runquery()
stDocName = "val_injectionduedate"
DoCmd.OpenQuery stDocName, acNormal, acEdit
End Sub
-------------------------------------------------
It's not overly important, just a nicety I'm doing as I know the user is prone to typos but would really appreciate a point in the right direction.
Basically if one date is older than the other date - display an error message
Otherwise, continue on.
I have been doing this for at least two days now (and today is my birthday).
I've been researching the DateDiff function as my other method I was trying didn't work as I wish. Does the DateDiff take the right date from the left date so that in some cases a negative answer might result? If not, I will revert back to the other method I was attempting and try going from that angle......
------------------------------------------
Private Sub injection_due_date_Exit(Cancel As Integer)
TestDate
End Sub
---------------------------------------------
Function TestDate()
Runquery
DoCmd.OpenTable "dobcheck", acNormal
Dim dob
Dim datecheck
If DateDiff("d", dob, datecheck) > 0 Then
MsgBox "Incorrect date!"
Else
DoCmd.close acTable, "dobcheck", acSaveNo
End If
End Function
-------------------------------------------
Sub Runquery()
stDocName = "val_injectionduedate"
DoCmd.OpenQuery stDocName, acNormal, acEdit
End Sub
-------------------------------------------------
It's not overly important, just a nicety I'm doing as I know the user is prone to typos but would really appreciate a point in the right direction.