Data Type Mismatch in criteria

I have the below code. It stops on the If DCount line and says Data Type
Mismatch in criteria expression. Run-Time Error '3464':

I can't figure out what is wrong..



Private Sub LookUpOrder_AfterUpdate()
' Find the record that matches the control.
Dim SID As String
Dim stLinkCriteria As String
Dim rsc As DAO.Recordset

Set rsc = Me.RecordsetClone

stLinkCriteria = "[LeadsID]='" & Me![LookUpOrder] & "'"

'Check table for for item number.
If DCount("LeadsID", "TblLead97", stLinkCriteria) >= 1 Then
'Go to record of original Number
rsc.FindFirst stLinkCriteria
Me.Bookmark = rsc.Bookmark

'If the item is not found the below code is run.
'Message box warning that part number doesn't exsist.

MsgBox "Order Number" _
& SID & " is not valid order number," _
& vbCr & vbCr & "check the number and try again." _
& vbCr & vbCr & "If the order is still not found" _
& vbCr & vbCr & "contact order entry.", vbExclamation _

End If
Set rsc = Nothing

End Sub

Matt Campbell
mattc (at) saunatec [dot] com

Message posted via


Relevant Pages