After entering a Start and Stop date on a record in a subform, I want to validate that the Stop date is greater than the Start date. If it isn't, I want the use to be sent back to the Stop date to re-enter it correctly.
This is the code I've used, however, after the message box OK button is clicked, the focus does not go to the STOPDATEcontrol, it goes to the next control in the tab sequence. I tried to trick it by first sending it to the STARTDATEcontrol, and then to the STOPDATEcontrol, and it works, but the date in the STOPDATEcontrol is not highlited, forcing me to delete it before entering a new date. If I send the focus to any other control on the subform, it works--it just won't work for STOPDATE.
Why is it doing this to me? Is AfterUpdate not the correct event?
Private Sub STOPDATE_AfterUpdate()
'Check to make sure the Stop date is greater than the Start Date
If Me![STOPDATE] < Me![START] Then
MsgBox "The Stop date must be greater than the Start date. Please check your entry and try again.", vbOKOnly