For Programmers: Free Programming Magazines  


Home > Archive > ASP > February 2006 > mismatch error









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author mismatch error
abbylee26@hotmail.com

2006-02-22, 6:55 pm

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?

Paxton

2006-02-22, 6:55 pm


abbylee26@hotmail.com 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.

abbylee26@hotmail.com

2006-02-22, 6:55 pm

Thanks...it worked after I put the sctr() around "[Total Charge]" also.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com