mismatch error

A

abbylee26

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?
 
P

Paxton

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,836
Messages
2,569,748
Members
45,545
Latest member
rapter____0

Latest Threads

Top