Having some problems getting the CheckBox Deletion from Access Database examples that I have seen in the Tek Tips Forum to work. I am getting a couple of different error messages depening on how I set up my variable types. I got this example from Ovatvvon from thread 333-73372. The cust_id key field in my CUSTHITS database was originally an autogenerating integer value, but during my troubleshooting, I have since changed it to a text field in the database (Thought that example was using a text based key field versus my integer based field). The error that I am getting is within the second ASP page when I'm attempting to do the deletion of the records that I have checked to be deleted. I get an:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'cust_id ='.
/pages/delblock.asp, line 21
error in my second page when the deleteRecord variable is not enclosed in quotes and when I change line 21 to look like the Forum example:
strSQL = "Delete * from custhits where ((cust_id) =" & deleteRecord & ""
I get an error that says:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Extra ) in query expression '((cust_id) =)'.
/pages/delblock.asp, line 21
Here's my code:
First ASP page*******************************************
<HTML>
<BODY>
<form name="FormName" method="post" action="delblock.asp">
<input type="button"><input type="submit" name="submitButtonName" value="Delete">
</form>
<p>
<%
Dim strSQL
Dim begDate
Dim endDate
Dim reccount
Dim passchecks
'Open a connection to our database
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection"
objConn.ConnectionString="DSN=webhits"
objConn.open
' Create our SQL statement variable
strSQL = "SELECT * FROM CUSTHITS Order by ins_date,ins_time"
reccount = 0
' Create a recordset to hold the records as they are read in
Dim objRS
Set objRS=Server.CreateObject("ADODB.Recordset"
objRS.Open strSQL,objConn
' Display the Contents of the Custhits Database
Do While Not objRS.EOF
Response.Write "<A HREF='Preview.asp'>"
Response.Write "<input type='checkbox' name='deleteRecord' value=" & objRS("cust_id" & ">Customer Record: " & objRS("cust_id" & " " & objRS("first_name" & " " & objRS ("last_name" & " " & objRS ("address" & objRS ("address" & "<BR>"
Response.Write "</A>"
reccount = reccount + 1
' Move to the next row in the CustHists table
objRS.MoveNext
Loop
Response.Write"End of Search Results.... " & reccount & " Records Retrieved" & "<BR>" & "<BR>"
Response.Write "<A HREF='dtsrch.asp' >."
Response.Write "Return to Web Customer Search Page."
Response.Write "</A>"
'Clean up the ADO objects
objRS.Close
Set ObjRS = Nothing
objConn.Close
Set objConn = Nothing
%>
</p>
</BODY>
</HTML>
Second ASP Page *******************************************
<%@ Language=VBScript %>
<% Option Explicit %>
<HTML>
<meta name="site-config-URL" content="">
<BODY>
<%
Dim deleteRecord
deleteRecord = request.form("deleteRecord"
Dim strSQL
Dim objRS
Dim objConn
'Open a connection to our database
Set objConn = Server.CreateObject("ADODB.Connection"
objConn.ConnectionString="DSN=webhits"
objConn.open
' Create a recordset to hold the records as they are read in
strSQL = "Delete * from custhits where cust_id =" & deleteRecord & " "
Set objRS=Server.CreateObject("ADODB.Recordset"
objRS.Open strSQL,objConn
'Clean up the ADO objects and exit
Set ObjRS = Nothing
Set objConn = Nothing
Response.Write "<A HREF = 'delsrch.asp'>"
Response.Write "Return to Web Deletion Page to Enter a New Customer ID Number."
Response.Write "</A>"
%>
</BODY>
<HTML>
I've spent a good deal of time troubleshooting and I just can't figure this one out. Any help that you can give me will be greatly appreciated.
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'cust_id ='.
/pages/delblock.asp, line 21
error in my second page when the deleteRecord variable is not enclosed in quotes and when I change line 21 to look like the Forum example:
strSQL = "Delete * from custhits where ((cust_id) =" & deleteRecord & ""
I get an error that says:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Extra ) in query expression '((cust_id) =)'.
/pages/delblock.asp, line 21
Here's my code:
First ASP page*******************************************
<HTML>
<BODY>
<form name="FormName" method="post" action="delblock.asp">
<input type="button"><input type="submit" name="submitButtonName" value="Delete">
</form>
<p>
<%
Dim strSQL
Dim begDate
Dim endDate
Dim reccount
Dim passchecks
'Open a connection to our database
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection"
objConn.ConnectionString="DSN=webhits"
objConn.open
' Create our SQL statement variable
strSQL = "SELECT * FROM CUSTHITS Order by ins_date,ins_time"
reccount = 0
' Create a recordset to hold the records as they are read in
Dim objRS
Set objRS=Server.CreateObject("ADODB.Recordset"
objRS.Open strSQL,objConn
' Display the Contents of the Custhits Database
Do While Not objRS.EOF
Response.Write "<A HREF='Preview.asp'>"
Response.Write "<input type='checkbox' name='deleteRecord' value=" & objRS("cust_id" & ">Customer Record: " & objRS("cust_id" & " " & objRS("first_name" & " " & objRS ("last_name" & " " & objRS ("address" & objRS ("address" & "<BR>"
Response.Write "</A>"
reccount = reccount + 1
' Move to the next row in the CustHists table
objRS.MoveNext
Loop
Response.Write"End of Search Results.... " & reccount & " Records Retrieved" & "<BR>" & "<BR>"
Response.Write "<A HREF='dtsrch.asp' >."
Response.Write "Return to Web Customer Search Page."
Response.Write "</A>"
'Clean up the ADO objects
objRS.Close
Set ObjRS = Nothing
objConn.Close
Set objConn = Nothing
%>
</p>
</BODY>
</HTML>
Second ASP Page *******************************************
<%@ Language=VBScript %>
<% Option Explicit %>
<HTML>
<meta name="site-config-URL" content="">
<BODY>
<%
Dim deleteRecord
deleteRecord = request.form("deleteRecord"
Dim strSQL
Dim objRS
Dim objConn
'Open a connection to our database
Set objConn = Server.CreateObject("ADODB.Connection"
objConn.ConnectionString="DSN=webhits"
objConn.open
' Create a recordset to hold the records as they are read in
strSQL = "Delete * from custhits where cust_id =" & deleteRecord & " "
Set objRS=Server.CreateObject("ADODB.Recordset"
objRS.Open strSQL,objConn
'Clean up the ADO objects and exit
Set ObjRS = Nothing
Set objConn = Nothing
Response.Write "<A HREF = 'delsrch.asp'>"
Response.Write "Return to Web Deletion Page to Enter a New Customer ID Number."
Response.Write "</A>"
%>
</BODY>
<HTML>
I've spent a good deal of time troubleshooting and I just can't figure this one out. Any help that you can give me will be greatly appreciated.