If (dateDifference > 7 Or dateDifference < -7) Then
will trap dates outside of the 7 day range in either direction.
Smith5646
Junior Poster in Training
65 posts since Nov 2009
Reputation Points: 34
Solved Threads: 9
Because I can't see the entire program, I'm confused with what is or isn't working in your code. In your original post, line 11 checks for a date more than 7 days ago. If dateDifference > 7 (date more than 7 days old), the error "Date is out of range" pops up and then the form closes. Is that what it is supposed to do for dates more than 7 days in the future also?
Smith5646
Junior Poster in Training
65 posts since Nov 2009
Reputation Points: 34
Solved Threads: 9
I'm really confused. Please replace line 11 of your original posted code with the following line
[INDENT]If (dateDifference > 7 Or dateDifference < -7) Then[/INDENT]
and then in detail tell me what the code is doing step by step, both right and wrong.
For example,
Date entered is more than 7 days in the future...
Line 13 - message is displayed - correct.
Line 15 - form closes - correct.
If the program is still not working after swapping line 11, please repost the current version.
Smith5646
Junior Poster in Training
65 posts since Nov 2009
Reputation Points: 34
Solved Threads: 9