Hello all,
I have a form that has been working great for over 2 years. Now all of a sudden it has an issue. The intent is that the form will not allow the user to enter a Lot Number that has already been used, and will set the focus back to the "DHRNumber" field and allow the user to make the correction and move on to the next field.
The problem is that focus is set back to the "DHRNumber" field but then you cannot move on to the next field. The only way to get around it is to close the form and reopen it, then you can proceed as normal.
Like I said, this just all of a sudden started happening, what am I missing?
The code is shown below for the On Lost Focus event.
Thanks in advance.
Code:
Private Sub DHRNumber_LostFocus()
On Error GoTo DuplicateLotNumber
DoCmd.RunCommand acCmdSaveRecord
Dim Num As Integer
Num = Err.Number
DuplicateLotNumber:
If Err.Number = 3022 Then
MsgBox "You have entered a Lot Number which already exists, Please verify you have the correct Lot Number", , "Duplicate Lot Number:"
End If
Me.Rev.SetFocus
Me.DHRNumber.SetFocus
End Sub