I'm encountering problem when I want to update records in the Access
database. I tried to output the SQL statement in the scteen and able to show
the entire statement correctly on the screen. However, when I tried to
execute the SQL statement, the statement does not show on the screen and the
transaction does not take place:

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Reminder Report</title>
</head>


<body>

<br>
<%
Dim strDBPath, SCONNECTION, dbConnection
Dim strApproval, rsApproval, strRejection, rsRejection
Dim intCounter, Leaveid, intTotal, strAccept, strReject

strDBPath = "C:\inetpub\wwwroot\teknion\db"
SCONNECTION="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath &
"\Leaves.mdb;Persist Security Info=False; Jet OLEDB:System Database=" &
strDBPATH & "\Secured.mdw;user id=dbadmin;"

SET dbConnection = CreateObject("ADODB.Connection")
SET rsApproval = CreateObject("ADODB.Recordset")
SET rsRejection = CreateObject("ADODB.Recordset")


dbConnection.open SCONNECTION


intTotal = Request.Form("Counter")
Response.Write intTotal

For intCounter = 1 to intTotal
Leaveid = Request.Form("Leaveid" & intCounter)
Response.Write "The leaveid is " & Leaveid
strAccept = UCase(Request.Form("Accept" & intCounter))
strReject = Ucase(Request.Form("Reject" & intCounter))
Response.Write strAccept
'Response.Write strReject

If strAccept = "ON" Then
strApproval = "UPDATE leave SET status='Approved' WHERE leaveid = '" &
leaveid & "'"
dbConnection.Execute strApproval
End If

If strReject = "ON" then
Response.Write "Rejected"
End If
Response.Write "<br>"

Next


%>

</body>
</html>

I hope you experts can give me some tips/hints on how to resolve this issue.
Many thanks in advance.

Re: Update Access Database by McKirahan

McKirahan
Mon Nov 07 08:33:42 CST 2005

"Seok Bee" <seokbee@yahoo.com> wrote in message
news:AC1588B3-A79C-4E7E-BB61-5D9FDAEC7E2F@microsoft.com...
> I'm encountering problem when I want to update records in the Access
> database. I tried to output the SQL statement in the scteen and able to
show
> the entire statement correctly on the screen. However, when I tried to
> execute the SQL statement, the statement does not show on the screen and
the
> transaction does not take place:
[snip]

> strApproval = "UPDATE leave SET status='Approved'
> WHERE leaveid = '" & leaveid & "'"

If "leaveid" is defined as a number then remove the aspostrophes.

WHERE leaveid = " & leaveid