L
Lee Taylor-Vaughan
Help!
the code below does not find the first record with the value
the controlnumberid field is a text field input mask is ##-######
code below, please help.
thanks
lee
CODE:
Private Sub ControlNumberID_BeforeUpdate(Cancel As Integer)
On Error GoTo CNError
If Not IsNull(Me.ControlNumberID) Then
With Me.RecordsetClone
.FindFirst "[ControlNumberID] = " & Me![ControlNumberID]
If Not .NoMatch Then
If MsgBox("There is already a record entered in the database
with this Control Number." _
& Chr(13) & "Click the 'OK' button to go to this record
now;" _
& "Click cancel to clear your entry and to enter a
different Control Number.") = vbOK _
Then
Cancel = True
Me.Undo
Me.Bookmark = .Bookmark
Else
Cancel = True
Me.ControlNumberID.Undo
End If
End If
End With
End If
ExitSub:
Exit Sub
CNError:
MsgBox Err.Number & " " & Err.Description
Resume ExitSub
End Sub
the code below does not find the first record with the value
the controlnumberid field is a text field input mask is ##-######
code below, please help.
thanks
lee
CODE:
Private Sub ControlNumberID_BeforeUpdate(Cancel As Integer)
On Error GoTo CNError
If Not IsNull(Me.ControlNumberID) Then
With Me.RecordsetClone
.FindFirst "[ControlNumberID] = " & Me![ControlNumberID]
If Not .NoMatch Then
If MsgBox("There is already a record entered in the database
with this Control Number." _
& Chr(13) & "Click the 'OK' button to go to this record
now;" _
& "Click cancel to clear your entry and to enter a
different Control Number.") = vbOK _
Then
Cancel = True
Me.Undo
Me.Bookmark = .Bookmark
Else
Cancel = True
Me.ControlNumberID.Undo
End If
End If
End With
End If
ExitSub:
Exit Sub
CNError:
MsgBox Err.Number & " " & Err.Description
Resume ExitSub
End Sub