I want to set the focus on the Email field if already exist. Not getting an error but it goes to the next field instead.
Code:
Private Sub Email_AfterUpdate()
If DCount("*", "tblContacts", "[Email] = '" & Me.Email & "'") > 0 Then
MsgBox "This Email already exists:-" & vbCrLf, vbOKOnly + vbExclamation
Me.Undo
Me.Email.SetFocus
End If
End Sub