Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Type Issue

Status
Not open for further replies.

Fattire

Technical User
Nov 30, 2006
127
US
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
 
Another way:
Code:
rec1.FindFirst "VENDOR_NUMBER='" & Me!txtVendorNumber & "'"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 

I should have known that, I'm an idiot this morning - thanks guys!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top