Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Posting to a checkbox field

Status
Not open for further replies.

Anthony1312002

Programmer
Mar 4, 2004
146
US
Does anyone remember how to post to a checkbox field? In Access the field value is Yes/No. I've tried using Request.Form instead of CleanInput but with no success.


Here is how I'm trying to do it but I'm getting a datatype mismatch in criteria error:

Option Explicit

Function CleanInput(strReqName)
CleanInput = Replace(Request.Form(strReqName),"'","''")
End Function

Dim sql_update, Conn, sql_users, rs_users, cmdDC, str_Times, str_EComments, str_OneToTwo

Set Conn = Server.CreateObject ("ADODB.Connection")
Set sql_users = Server.CreateObject ("ADODB.Recordset")
conn.open "RemitcoDSN"
Set cmdDC = Server.CreateObject("ADODB.Command")
cmdDC.ActiveConnection = Conn
sql_users = "SELECT * FROM tblShiftTurnover"
Set rs_users = conn.Execute(sql_users)



str_OneToTwo = CleanInput("1To2_YN")
str_Times = CleanInput("Time_n")
str_EComments = CleanInput("txtExtractCommenta")


sql_update = "INSERT INTO tblShiftTurnover(OneToTwo,ShiftTime,E_Comments)" & _
"VALUES('" & str_OneToTwo & "','" & str_Times & "','" & str_EComments & "')"


Conn.Execute sql_update

Response.Redirect "ShiftTurnover.asp"
 
CleanInput is the name of a function you have created. I assume that "1To2_YN" is the name of a field from the posted page. But the way you have it written it reads that you want to check CleanInput against the string "1To2_YN", not the variable from the posted page. I might change it to this:
Code:
str_OneToTwo = CleanInput(Request.Form("1To2_YN"))

------------------------------------------------------------------------------------------------------------------------
If you don't have a sense of humor, you probably don't have any sense at all.
- Anonymous
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top