I have designed a very simple access form so that a user can enter subscriber ids. I need to force the user to validate the entry and I chose the simple method of typing the id into 2 text boxes, much like the validation when you change your password. I am having difficulty coding for the situation where the user miskeys the id in the 2nd box. I am coding a procedure on the enter event of the 2nd box (confirm) to display an error msgbox when the miskey is recognized (idtxt.value <> confirmtxt.value). After entering the first id, the cursor returns to the 1st box, but the text remains in the 2nd box, which causes the error msgbox to pop up when tabbing from the 1st box with the new id. Am I going about this the wrong way...can I accomplish the same thing using a macro ? It has been over 5 years since my VB class and unfortunately I never got the chance to use the knowledge, so I'm more than a little rusty.
Thanks for any help. I have copied my code below. Confirmtxt is the 2nd box.
Private Sub Confirmtxt_Enter()
Dim LResponse As Integer
If (IDtxt.Value <> Confirmtxt.Value) And (Confirmtxt.Value <> "") Then
LResponse = MsgBox("Id# Mismatch")
End If
If LResponse = vbOK Then
Confirmtxt.Text = ""
Confirmtxt.SetFocus
Exit Sub
End If
If Confirmtxt.Value = "" Then
MsgBox ("Id# Must Be Confirmed")
Confirmtxt.Text = ""
Confirmtxt.SetFocus
End If
Confirmtxt.Text = ""
End Sub