Hello
Another problem that I hope someone can suggest a solution for!
Basically, there are a number of dates entered by the user on a form that need to be within certain parameters based on another date in the form. In the first example the date DateRequestedFromExrTarget needs to be between 8 and 11 months before DateOfExam. I had a look through the forum and came up with this for the beforeupdate event
If Not (DateRequestedFromExrTarget >= DateAdd("m", -11, DateOfExam) And DateRequestedFromExrTarget <= DateAdd("m", -8, DateOfExam)) Then
Msgbox "Date Requested From Examiner Target out of range", vbOKOnly
Cancel = True
End If
This seems to work fine. However, the next validation is for FinalCopyReceivedTarget to be between 6 and 1 months before DateOfExam. I tried this
If Not (FinalCopyReceivedTarget >= DateAdd("m", -6, DateOfExam) And FinalCopyReceivedTarget <= DateAdd("m", -1, DateOfExam)) Then
Msgbox "Final Copy Received Target out of range", vbOKOnly
Cancel = True
End If
But this gives me a syntax error when it compiles the code.
Any ideas?
Another problem that I hope someone can suggest a solution for!
Basically, there are a number of dates entered by the user on a form that need to be within certain parameters based on another date in the form. In the first example the date DateRequestedFromExrTarget needs to be between 8 and 11 months before DateOfExam. I had a look through the forum and came up with this for the beforeupdate event
If Not (DateRequestedFromExrTarget >= DateAdd("m", -11, DateOfExam) And DateRequestedFromExrTarget <= DateAdd("m", -8, DateOfExam)) Then
Msgbox "Date Requested From Examiner Target out of range", vbOKOnly
Cancel = True
End If
This seems to work fine. However, the next validation is for FinalCopyReceivedTarget to be between 6 and 1 months before DateOfExam. I tried this
If Not (FinalCopyReceivedTarget >= DateAdd("m", -6, DateOfExam) And FinalCopyReceivedTarget <= DateAdd("m", -1, DateOfExam)) Then
Msgbox "Final Copy Received Target out of range", vbOKOnly
Cancel = True
End If
But this gives me a syntax error when it compiles the code.
Any ideas?