E
Ed
The code in a subform does not cancel and does not give the focus to
TimeStartPeer. It does retain the old value and does show the message box.
Private Sub TimeStartPeer_AfterUpdate()
If DateDiff("n", [TimeStartPeer], [TimeEndPeer]) < 0 Then
DoCmd.CancelEvent
TimeStartPeer = TimeStartPeer.OldValue
TimeStartPeer.SetFocus
MsgBox "End Time can not be before Start Time!", _
vbCritical, "Meeting Time Error"
End If
End Sub
TimeStartPeer. It does retain the old value and does show the message box.
Private Sub TimeStartPeer_AfterUpdate()
If DateDiff("n", [TimeStartPeer], [TimeEndPeer]) < 0 Then
DoCmd.CancelEvent
TimeStartPeer = TimeStartPeer.OldValue
TimeStartPeer.SetFocus
MsgBox "End Time can not be before Start Time!", _
vbCritical, "Meeting Time Error"
End If
End Sub