I am a newbie here, so this may be a simple question. I am doing multiple data error checks on a data entry form (in a function). If the user enters something invalid, the function writes out an appropriate error message, and I would like to "erase" the bad data and keep the cursor in the control so the user can retry. There are two cases here: (a) initial data entry, nothing previously in the field, and (b) data entry already done, and the user goes back and changes the field. If I use the Exit event as in the code below, then focus stays in the control but the Undo does not work for case (b). If I use the same code in the BeforeUpdate event, then the Undo works for case (b). To get what I want (undo in both cases) do I have to use both the BeforeUpdate event AND the Exit event? Seems like there should be a better way. My main question is why doesn't Undo work in the Exit event coded below? Thanks for any help.
Private Sub TxtLtot_Exit(Cancel As Integer)
Dim CheckOto As Integer
CheckOto = Me.cmbPreySpecies.Column(2)
' Check for errors in data entry
If fnCheckTots(CheckOto, 0, Me.TxtLtot) = "No" Then
Me.TxtLtot.Undo
Cancel = True
End If
End Sub