G
Guest
This is a repost from another section (wrong section).
I have a txtbox on a form that the user will place an 8 place number. In the
table it is listed as Number/Long Integer. However, I continue to get a type
mismatch error notice. Below is the coding that I am using.
Private Sub ClaimNumber_BeforeUpdate(Cancel As Integer)
On Error GoTo ErrorHandler
Dim strWhere As Long
With Me.ClaimNumber
If .Value = .OldValue Then
Else
strWhere = "[ClaimNumber]=""" & .Value & """"
If Not IsNull(DLookup("ClaimNumber", "tblSurveyResponses",
strWhere)) Then
MsgBox "The Claim Number is a duplicate and will need to
be changed. " & _
"The computer may also follow with a warning
message. If so, select the OK " & _
"button and proceed to change the Claim Number. You
will continue to get " & _
"this message until the duplication is corrected.
You will also not be able " & _
"to proceed until the duplication is corrected.",
vbOKOnly, "DUPLICATE CLAIM NUMBER"
Cancel = True
End If
End If
End With
exit_ClaimNumber_BeforeUpdate:
Exit Sub
ErrorHandler:
MsgBox Err.Description
Resume exit_ClaimNumber_BeforeUpdate
End Sub
Can anyone see where I am going wrong? Thanks in advance for the assistance.
*** John
I have a txtbox on a form that the user will place an 8 place number. In the
table it is listed as Number/Long Integer. However, I continue to get a type
mismatch error notice. Below is the coding that I am using.
Private Sub ClaimNumber_BeforeUpdate(Cancel As Integer)
On Error GoTo ErrorHandler
Dim strWhere As Long
With Me.ClaimNumber
If .Value = .OldValue Then
Else
strWhere = "[ClaimNumber]=""" & .Value & """"
If Not IsNull(DLookup("ClaimNumber", "tblSurveyResponses",
strWhere)) Then
MsgBox "The Claim Number is a duplicate and will need to
be changed. " & _
"The computer may also follow with a warning
message. If so, select the OK " & _
"button and proceed to change the Claim Number. You
will continue to get " & _
"this message until the duplication is corrected.
You will also not be able " & _
"to proceed until the duplication is corrected.",
vbOKOnly, "DUPLICATE CLAIM NUMBER"
Cancel = True
End If
End If
End With
exit_ClaimNumber_BeforeUpdate:
Exit Sub
ErrorHandler:
MsgBox Err.Description
Resume exit_ClaimNumber_BeforeUpdate
End Sub
Can anyone see where I am going wrong? Thanks in advance for the assistance.
*** John