Check date value before storing

  • Thread starter Thread starter frank knuckles
  • Start date Start date
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
 
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.



--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top