topdesk123
Programmer
Hello All!
I use the following code in time cards when someone tries to change an existing time card:
Private Sub EmployeeID_Change()
On Error GoTo EmployeeID_Change_Err
Dim intAnswer As Integer
If Not IsNull(Me![EmployeeID]) And Not Me.NewRecord Then
intAnswer = MsgBox("You are about to change an existing record. " & Chr(13) & Chr(10) & "Would you like to continue?", vbYesNo + vbQuestion, "Existing Record")
Select Case intAnswer
Case vbYes
MsgBox "Thank you. Please continue", vbOKOnly
Me.EmployeeID.SetFocus
Case vbNo
MsgBox "Thank you. Changes will be cancelled", vbOKOnly, "Entry process continuing."
Me.Undo
End Select
End If
EmployeeID_Change_Exit:
Exit Sub
EmployeeID_Change_Err:
MsgBox Err.Description
Resume EmployeeID_Change_Exit
End Sub
The code works good, except it prompts the user at every keystroke in the field. What am I missing?
TIA
topdesk
I use the following code in time cards when someone tries to change an existing time card:
Private Sub EmployeeID_Change()
On Error GoTo EmployeeID_Change_Err
Dim intAnswer As Integer
If Not IsNull(Me![EmployeeID]) And Not Me.NewRecord Then
intAnswer = MsgBox("You are about to change an existing record. " & Chr(13) & Chr(10) & "Would you like to continue?", vbYesNo + vbQuestion, "Existing Record")
Select Case intAnswer
Case vbYes
MsgBox "Thank you. Please continue", vbOKOnly
Me.EmployeeID.SetFocus
Case vbNo
MsgBox "Thank you. Changes will be cancelled", vbOKOnly, "Entry process continuing."
Me.Undo
End Select
End If
EmployeeID_Change_Exit:
Exit Sub
EmployeeID_Change_Err:
MsgBox Err.Description
Resume EmployeeID_Change_Exit
End Sub
The code works good, except it prompts the user at every keystroke in the field. What am I missing?
TIA
topdesk