I'm passing variables via the URL to an ASP page and then using same to query an Access db and I keep getting the "data type mismatch in criteria expression" error. The variable is a milepost reading up to the thousandths. In the Access DB the data shows as field size = double and decimals as auto. I've tried using both the CDbl and the CDec functions to convert my variables to the correct data type prior to doing the SQL query. I had the same problem with two other variables but converted those to text in the db to fix those but don't want to do that with this one. Here is what I have:
milepostS = Request.QueryString("MILEPOST")
roadNumberS = Request.QueryString("ROAD_NUMBE")
sequenceS = Request.QueryString("SEQUENCE")
milepost = CDbl(milepostS)
SQL = "SELECT * FROM culverts WHERE ROAD_NUMBE = '" & roadNumberS & "' AND MILEPOST = '" & milepost & "' AND SEQUENCE= '" & sequenceS & "'"
Set RS = Conn.execute(SQL)
How should I convert milepostS to the proper type?