Hi D
I think that the problem lies with the fact that you are using an Input Template on the field(s) and Access is doing a low-level check before handing back to VBA and will not allow the focus to move to another control if the data input is inaccurate or incomplete. I think that if you use nice little features like the input template then you must play by Access rules and make users press the escape key manually.
I've built a demo form and can replicate your issue. I've tried putting a MsgBox in the Before Update event but Access will not even get there unless the data is compliant. Text0 is a text box with a template
- Private Sub Text0_BeforeUpdate(Cancel As Integer)
-
On Error GoTo Err_Text0_beforeUpdate
-
-
If Me.Text0 > 1 Then
-
MsgBox "Hi"
-
End If
-
-
Exit_Text0_BeforeUpdate:
-
Exit Sub
-
-
Err_Text0_beforeUpdate:
-
MsgBox err.Number & " - " & err.Description
-
Cancel = True
-
-
Resume Exit_Text0_BeforeUpdate
-
-
End Sub
If you the Sendkeys command at line 14 this would cancel the data in Text0 (and I agree with Fish that it is often unreliable) then I would use;
I have fallen into the habit of using two 'escapes' to make sure it works but on this occasion could cancel other inputs which may be correct.
I also know that MS code is not case sensitive but in the past (when grasping at straws!) I've changed {esc} or {ESC} to upper and lower case {Esc}, although this is probably no more effective than crossing your fingers!
However, this is all acedemic because as I said above I don't think this will help you in your present problem but will watch with interest for a more expert diagnosis.
Best of luck