I have a little form where you type a vendor number and it goes to that record in the database, the vendor number is a text field in the table and the text box on the form has no formatting to it, but it says I have a data type mismatch, not sure why.
Code:
Private Sub cmd_GoToVendor_Click()
Dim rec1 As DAO.Recordset
If Trim(Me.txtVendorNumber & " ") = "" Then
MsgBox "Please enter a vendor number", vbOKOnly, "Oops..."
Else
Set rec1 = Forms!FRM_MAIN.RecordsetClone
'This line below is where I get the data type error..
rec1.FindFirst "VENDOR_NUMBER=" & Me!txtVendorNumber
If Not rec1.NoMatch Then Forms!FRM_MAIN.Bookmark = rec1.Bookmark
DoCmd.Close acForm, "FRM_SEARCH"
If rec1.NoMatch Then MsgBox "That vendor number does not exist in the database.", vbExclamation
End
End If
End
End Sub