Data type mismatch on recordsource

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chibbie23
    New Member
    • Mar 2010
    • 44

    Data type mismatch on recordsource

    Im a 3rd year computer science student. I am using adodc on my project, i dont know whats wrong, I'm trying to set the recordsource of my adodc, and trying to filter my database with a criteria that has an integer datatype. . .i think i have tried everything:

    me.Adodc1.Recor dsource = "Select * from tbltrans where Service_Tag = '" & me.Text1.text & "' "

    me.Adodc1.Recor dsource = "Select * from tbltrans where Service_Tag = '" + val(me.Text1.te xt) + "' "

    me.Adodc1.Recor dsource = "Select * from tbltrans where Service_Tag = ' me.Text1.text ' "

    when i try to debug my code, i reaized that it could get the value of of the textbox or the variable, but it always say "Datatype mismatch" . . .
    i need some help,
  • vb5prgrmr
    Recognized Expert Contributor
    • Oct 2009
    • 305

    #2
    If it is a number then don't use the single ticks (') to surround your value...

    Code:
    strSQL = "SELECT * FROM tablename WHERE numericfieldname = " & Val(Trim(Text1.Text))


    Good Luck

    Comment

    • chibbie23
      New Member
      • Mar 2010
      • 44

      #3
      thanks

      It worked. . .i'm really ;lucky to have discovered this site. . .
      hehehe

      Comment

      Working...