Results 1 to 3 of 3
  1. #1
    Join Date
    May 2004
    Posts
    9

    Unanswered: SQL queries - data mismatch error when sending integer values

    Hi there folks,

    I have the following code for which I am getting errors (data mismatch error)

    If KeyAscii = 13 Then

    Dim rs As Object

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[Order ID] = '" & (Right(Left(Me![txtSearch], 2), 1)) & "'"
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark

    End If


    The field order ID is an autonumber field, and I think access is throwing up the error because the query is being sent as a string.

    How can I get past this? All I want is a text box where the user can search for an individual order number.

    Many thanks

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by glennandrewcoop
    Hi there folks,

    I have the following code for which I am getting errors (data mismatch error)

    If KeyAscii = 13 Then

    Dim rs As Object

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[Order ID] = '" & (Right(Left(Me![txtSearch], 2), 1)) & "'"
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark

    End If


    The field order ID is an autonumber field, and I think access is throwing up the error because the query is being sent as a string.

    How can I get past this? All I want is a text box where the user can search for an individual order number.

    Many thanks
    Remove the single apostrophes ...

    ... "[Order ID] = " & (Right(Left(Me![txtSearch], 2), 1))
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    May 2004
    Posts
    9

    Data mismatch error

    Doh!

    Its obvious now when I think about it!

    Thanks for the quick response!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •