G
Guest
Re Access XP (no SP's)
I have a continuous form which needs to validate two text boxes (i.e. one
number entered is greater than the other)
If the data is invalid when the user clicks away from the current record, I
want to cancel the update and return to the offending text box.
I am using the LostFocus event of one of the text boxes to make the check,
and display an appropriate message:
Private Sub txtThisWk_LostFocus()
If txtLastWk > txtThisWk Then
MsgBox "This week's milage is less than last weeks!" & vbCrLf & _
"Please re-enter.", vbCritical, "Stop!"
Me!txtThisWk.Undo
'txtThisWk.SetFocus
End If
End Sub
The problem is that the form does not return to the offending record and
does not cancel the update i.e. it updates the record even with the wrong
value.
How can I cancel and return focus to the offending record (the very last
record updated?
Is there a single command to achieve this or will I need to ues the
RecorsetClone method?
Many thanks.
I have a continuous form which needs to validate two text boxes (i.e. one
number entered is greater than the other)
If the data is invalid when the user clicks away from the current record, I
want to cancel the update and return to the offending text box.
I am using the LostFocus event of one of the text boxes to make the check,
and display an appropriate message:
Private Sub txtThisWk_LostFocus()
If txtLastWk > txtThisWk Then
MsgBox "This week's milage is less than last weeks!" & vbCrLf & _
"Please re-enter.", vbCritical, "Stop!"
Me!txtThisWk.Undo
'txtThisWk.SetFocus
End If
End Sub
The problem is that the form does not return to the offending record and
does not cancel the update i.e. it updates the record even with the wrong
value.
How can I cancel and return focus to the offending record (the very last
record updated?
Is there a single command to achieve this or will I need to ues the
RecorsetClone method?
Many thanks.