E
Ed Rawley
I have a database filled with 7 digit numbers, all unique,
that have been indexed. Need to find if the number exits
in table. I ran the following code at it and got an error
of "Datatype mismatch in criteria expresion". Any help
would be appreciated.
Private Sub btnSearch_Click()
' Stop if a value has not been entered
If IsNull([dblFindMe]) Or [dblFindMe] = "" Then
Exit Sub
End If
'otherwise
Dim strCrit As String
Dim i As Integer
Dim strmsg As String
strCrit = [dblFindMe]
i = DCount("[dblNumber]", "tbl216", "[dblNumber]='" &
strCrit & "'")
'set message based on wether the value is already in the
table
If i = 0 Then
strmsg = "Item Not Listed"
Else
strmsg = "Item is Already Listed."
End If
'dispaly message in a message box
MsgBox strmsg
End Sub
that have been indexed. Need to find if the number exits
in table. I ran the following code at it and got an error
of "Datatype mismatch in criteria expresion". Any help
would be appreciated.
Private Sub btnSearch_Click()
' Stop if a value has not been entered
If IsNull([dblFindMe]) Or [dblFindMe] = "" Then
Exit Sub
End If
'otherwise
Dim strCrit As String
Dim i As Integer
Dim strmsg As String
strCrit = [dblFindMe]
i = DCount("[dblNumber]", "tbl216", "[dblNumber]='" &
strCrit & "'")
'set message based on wether the value is already in the
table
If i = 0 Then
strmsg = "Item Not Listed"
Else
strmsg = "Item is Already Listed."
End If
'dispaly message in a message box
MsgBox strmsg
End Sub