user578086
user578086

Reputation: 331

Data type mismatch in criteria expression

Does anyone know why the following SQL statement returns the above error?

sSQL="INSERT INTO Table_Name (field_name) VALUES (""'" & Request.Form(POSTval) & "'"")"

POSTVal should contain a string from the first form textbox since this query is only called by a if statement to ensure that we're at the right spot. Thanks!

P.S. Using a MS Access DB

Upvotes: 0

Views: 453

Answers (2)

fdaines
fdaines

Reputation: 1236

Request.Form is a Map, and the keys are Strings, then you have to use quotes.

Request.Form("POSTval")

Upvotes: 0

mikeY
mikeY

Reputation: 519

I think I would try:

myinsert= Request.Form("POSTval")
sSQL="INSERT INTO Table_Name (field_name) VALUES ('" & myinsert & "')"

You might also verify that Request.Form("POSTval") has a value and is not NULL.

Upvotes: 1

Related Questions