VBA Code Problem - double-click property

S

Salisha Khan

Hey everyone,
I am creating this form, and I am going to allow the user to
double-click on the caseid field. When the user double-clicks on the caseid
field, he/she should be able to type in any case id and then the record
relating to that caseid should populate the form. Here is my code, but it
doesnt' seem to be working. Can some help me out with this. Thanks in
advance.

Private Sub txtCaseNum_DblClick(Cancel As Integer)
Dim X, stSQL As String, errct As Integer
errct = 0
On Error GoTo Err_Sub
X = InputBox("ENTER Case #")
If X = "" Then Exit Sub
X = Right("00" & "-" & "00000" & Trim(X), 8)

Recheck:
DoCmd.FindRecord X, , , acSearchAll

Exit_Sub:
Exit Sub

Err_Sub:
If Err.Number = 2137 Then
If errct <= 10 Then
Err.Clear
errct = errct + 1
GoTo Recheck
End If
MsgBox "Case number does not exist."
GoTo Exit_Sub
End If
MsgBox Err.Number & " " & Err.Description
End Sub
 
Top