Error 3464 - Data type mismatch

downhilljon

Registered User.
Local time
Tomorrow, 07:32
Joined
Jun 14, 2007
Messages
31
Hi there,

I am having this annoying problem I can't solve, would appreciate some fresh eyes to look over the code for me.

When I get to the bold line below, I get run-time error 3464: Data type mismatch in criteria expression.

Confusing, as strSerial is a string, and the field "SerialNumber" is a text field. Maybe there are some settings to do with the field I have wrong...

Code:
Dim intSerial As Integer
Dim strSerial As String

strSerial = Forms![frmOutputs_2_Specific_Search_for_Bike].txtSerial

[B]intSerial = DCount("SerialNumber", "tblBikes_In_Stock", "SerialNumber = " & strSerial)[/B]
If intSerial > 0 Then
    MsgBox "This serial number already exists in the database - Please check your details", vbExclamation, "Duplicate Serial Number"
    GoTo CleanUp
End If

Thanks in advance,
Jon
 
intSerial = DCount("SerialNumber", "tblBikes_In_Stock", "SerialNumber = '" & strSerial & "'")
 

Users who are viewing this thread

Back
Top Bottom