Check date value before storing

F

frank knuckles

I have the following code in a DateRequest's afterupdate:

If DateRequest > Date Then
MsgBox "Date Request can't have a future value"
DateRequest.SetFocus
End If

However, this doesn't work. The value is stored anyway and the focus is
moved to the next field.
Can someone tell me what I'm doing wrong?
Thank you.

FK
 
F

frank knuckles

Thanks! It's working.

ruralguy via AccessMonster.com said:
Your code should be in the BeforeUpdate event and set Cancel = True if the
validation fails and you want to hold the focus in the current control.
No
SetFocus command necessary.
 
Top