mismatch error

Discussion in 'ASP General' started by abbylee26@hotmail.com, Feb 22, 2006.

  1. Guest

    sSQL = "SELECT [Billing Date], [Service Number], [Subscriber User
    Name]," & _
    " Fund, Account,[Activity Code], Description, [Total Charge]" & _
    " FROM 06_Statements" & _
    " WHERE [Billing Date] = '" & Request.Form("cmonth") & "'" & _
    " AND [Service Number] = '" & Request.Form("cnumb") & "'" & _
    " AND [Total Charge] = '" & Request.Form("camount") & "'"
    set rs = Connect.Execute(sSQL)

    This query does not work...I get the error message:
    Error Type:
    Microsoft JET Database Engine (0x80040E07)
    Data type mismatch in criteria expression.


    If I remove the following line, the statement works fine?
    " AND [Total Charge] = '" & Request.Form("camount") & "'"


    Request.Form("camount") is a number (.34, 1.2, 9, etc)
    the "Total Charge" field in the Access DB is a text field.


    I assume I'm comparing apples and oranges. What must I do to get this
    to work?
    , Feb 22, 2006
    #1
    1. Advertising

  2. Paxton Guest

    wrote:
    > sSQL = "SELECT [Billing Date], [Service Number], [Subscriber User
    > Name]," & _
    > " Fund, Account,[Activity Code], Description, [Total Charge]" & _
    > " FROM 06_Statements" & _
    > " WHERE [Billing Date] = '" & Request.Form("cmonth") & "'" & _
    > " AND [Service Number] = '" & Request.Form("cnumb") & "'" & _
    > " AND [Total Charge] = '" & Request.Form("camount") & "'"
    > set rs = Connect.Execute(sSQL)
    >
    > This query does not work...I get the error message:
    > Error Type:
    > Microsoft JET Database Engine (0x80040E07)
    > Data type mismatch in criteria expression.
    >
    >
    > If I remove the following line, the statement works fine?
    > " AND [Total Charge] = '" & Request.Form("camount") & "'"
    >
    >
    > Request.Form("camount") is a number (.34, 1.2, 9, etc)
    > the "Total Charge" field in the Access DB is a text field.
    >
    >
    > I assume I'm comparing apples and oranges. What must I do to get this
    > to work?


    AND [Total Charge] = '" & cstr(Request.Form("camount")) & "'"

    /P.
    Paxton, Feb 22, 2006
    #2
    1. Advertising

  3. Guest

    Thanks...it worked after I put the sctr() around "[Total Charge]" also.
    , Feb 22, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. data type mismatch error

    , Aug 10, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    635
    Karl Seguin
    Aug 10, 2005
  2. type mismatch error

    , Aug 12, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    3,358
    Kevin Spencer
    Aug 12, 2005
  3. Chris Matuszewski
    Replies:
    0
    Views:
    1,424
    Chris Matuszewski
    Aug 24, 2003
  4. Stephen Briley

    "datatype mismatch error" in MS Access

    Stephen Briley, Feb 6, 2004, in forum: Python
    Replies:
    2
    Views:
    807
    Tim Roberts
    Feb 6, 2004
  5. Steve Briley

    MS Access datatype mismatch error

    Steve Briley, Feb 6, 2004, in forum: Python
    Replies:
    2
    Views:
    563
    Ian Parker
    Feb 7, 2004
Loading...

Share This Page