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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access database error

Status
Not open for further replies.

Vonique

Programmer
Apr 23, 2002
1
US
I keep getting this error message when I try to edit a record in my database of employees:

"[Microsoft][ODBC Microsoft Access Driver] Internal OLE Automation error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e21'

And then when I try to search for a specific employee I get this:
"The request properties can not be supported by this ODBC Driver".

And this is the line to which it refers.

"rsRecords.Open sql, Conn, adOpenKeyset, adLockReadOnly, adCmdText"

I have a connection to the database because all the other features work such as adding an employee or searching for a specific department. Then all of the employees of that department are returned. I just can't edit a record or search for a specific employee.

Do I need to update my driver? Here's my code:

<%@ LANGUAGE=&quot;VBSCRIPT&quot; %>

<%

Depts = Application(&quot;Depts&quot;)
for i = 0 to UBound(Depts,2)
if Cstr(Depts(0,i)) = request.querystring(&quot;DepartmentID&quot;) or Cstr(Depts(0,i)) = request.form(&quot;DepartmentID&quot;) then
strDept = Depts(1,i)
end if
next

if request.querystring(&quot;DepartmentID&quot;) <> &quot;&quot; then
Session(&quot;DeptID&quot;) = request.querystring(&quot;DepartmentID&quot;)
end if
On Error Resume Next
dim Conn, name, dept, homePhone, ext, id, oldName, sql
if request.form(&quot;Name&quot;) <> &quot;&quot; then
name = Request.Form(&quot;Name&quot;)
dept = Request.Form(&quot;DepartmentID&quot;)
homePhone = Request.Form(&quot;Home_Phone&quot;)
ext = Request.Form(&quot;Extension&quot;)
id = request.form(&quot;ID&quot;)
oldName = request.form(&quot;oldName&quot;)
Set Conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
Conn.open(&quot;employee&quot;)

if request.form(&quot;deleteMe&quot;) = &quot;DELETE&quot; then
sql = &quot;DELETE FROM Employees&quot;
else
sql = &quot;UPDATE Employees SET &quot;
sql = sql & &quot;DepartmentID=&quot; & dept & &quot;,&quot; & &quot;Name = '&quot;
sql = sql & replace(name,&quot;'&quot;,&quot;'&quot;) & &quot;',&quot;
sql = sql & &quot;Home_Phone = '&quot; & homePhone & &quot;',&quot;
sql = sql & &quot;Extension = '&quot; & ext & &quot;'&quot;
end if
sql = sql & &quot; WHERE DepartmentID=&quot; & Session(&quot;DeptID&quot;)
sql = sql & &quot; AND ID =&quot; & id
sql = sql & &quot; AND Name = '&quot;
sql = sql & replace(oldName,&quot;'&quot;,&quot;'&quot;) & &quot;'&quot;

'Debug
'Response.write(sql)

Conn.Execute(sql)
Conn.Close

%>

<html>
<head>

<% if left(sql,6) = &quot;DELETE&quot; then %>

<title>Deletion Results</title>
<style>
<!--
body,td {background-color: #ffffff; color: #000080; font-weight: bold;}
-->
</style>
</head>
<body>
<h2>Deletion Results</h2>
<hr>
<b>The record you deleted:</b><p>

<% elseif left(sql,6) = &quot;UPDATE&quot; then %>

<title>Update Results</title>
<style>
<!--
body,td {background-color: #ffffff; color: #000080; font-weight: bold;}
-->
</style>
</head>
<body>
<h2>Update Results</h2>
<hr>
<b>The record you updated now contains:</b><p>
<%
if err.number <> 0 then
response.write(&quot;An error occurred with your input.<BR>&quot;)
response.write(&quot;You probably have a conflict with another input (no duplicate extensions).<br>&quot;)
response.write(&quot;The following data was <i>not</i> added to the employee database.<br>Please try again.<p>&quot;)
response.write(err.description & &quot;<p>&quot;)
end if
end if
%>

<table border=&quot;1&quot;>
<tr><td>Department<td><%=strDept %>
<tr><td>Name<td><%=name %>
<tr><td>Home Phone<td><%=homePhone%>
<tr><td>Extension<td><%=ext %>

</table>
<p><br>

<!-- #include file=&quot;footer.inc&quot;-->
</body>
</html>

<%
else
%>

<!--#include file=&quot;validate.inc&quot;-->
<html>
<head>
<title>Update/Delete</title>
<style>
<!--
body {background-color: #ffffff; color: #000080}
-->
</style>
</head>

<body>
<h2>Update/Delete a record</h2>
<hr>

<table>
<form name=&quot;empForm&quot; method=&quot;post&quot; action=&quot;edit.asp&quot;>

<tr><td align=&quot;right&quot; Valign=&quot;top&quot;><b>Department:</B>
<td><select name=&quot;DepartmentID&quot;>

<%
Depts = Application(&quot;Depts&quot;)
for i = 0 to UBound(Depts,2)
response.write(&quot;<OPTION &quot;)
if Cstr(Depts(0,i)) = request.querystring(&quot;DepartmentID&quot;) then
response.write(&quot;SELECTED&quot;)
end if
response.write(&quot; value=&quot; & Depts(0,i) & &quot;>&quot; & Depts(1,i))
next
%>

</select>

<tr><td align=&quot;right&quot; Valign=&quot;top&quot;><b>Name:</b><td><input type=&quot;text&quot; name=&quot;Name&quot; value=&quot;<%=request.querystring(&quot;Name&quot;) %>&quot;>
<tr><td align=&quot;right&quot; Valign=&quot;top&quot;><b>Home Phone:</b><td><input type=&quot;text&quot; name=&quot;Home_Phone&quot; value=&quot;<%=request.querystring(&quot;Home_Phone&quot;) %>&quot;>
<tr><td align=&quot;right&quot; Valign=&quot;top&quot;><b>Extension:</b><td><input type=&quot;text&quot; name=&quot;Extension&quot; value=&quot;<%=request.querystring(&quot;Extension&quot;) %>&quot;>

<p><p>

<tr><td align=&quot;center&quot; colspan=&quot;2&quot;>
<input type=&quot;hidden&quot; name=&quot;ID&quot; value=&quot;<%=request.querystring(&quot;ID&quot;) %>&quot;>
<input type=&quot;hidden&quot; name=&quot;oldName&quot; value=&quot;<%=request.querystring(&quot;Name&quot;) %>&quot;>
<input type=&quot;hidden&quot; name=&quot;deleteMe&quot;>
<input type=&quot;button&quot; name=&quot;cmdSubmit&quot; value=&quot;Update&quot; OnClick=&quot;Validate()&quot;>
<input type=&quot;reset&quot; name=&quot;cmdReset&quot; value=&quot;Reset&quot;>
<input type=&quot;button&quot; name=&quot;cmdDelete&quot; value=&quot;Delete&quot; OnClick=&quot;funcDelete()&quot;>

</form>
</table>
<p><br>
<!-- #include file=&quot;footer.inc&quot;-->
<script language=&quot;Javascript&quot;>
<!--
// This routine validates the input from the form

function Validate() {
//var iCount = 0;

if (document.forms[0].Name.value == &quot;&quot;) {
alert(&quot;Please enter a value for Name&quot;);
document.forms[0].Name.focus();
return;
}

if (document.forms[0].Home_Phone.value == &quot;&quot;) {
alert(&quot;Please enter a value for Home Phone&quot;);
document.forms[0].Home_Phone.focus();
return;
}

if (document.forms[0].Extension.value == &quot;&quot;) {
alert(&quot;Please enter a value for Extension&quot;);
document.forms[0].Extension.focus();
return;
}

if(confirm(&quot;You are about to update a record for: \n <%=strDept%> (<%=replace(request.querystring(&quot;Name&quot;),&quot;'&quot;,&quot;'&quot;,1,-1,1)%>) \n Are you sure you want to proceed?&quot;)){
document.forms[0].submit();
}
return;
}

function funcDelete() {
if(confirm(&quot;You are about to delete a record for: \n <%=strDept%> (<%=replace(request.querystring(&quot;Name&quot;),&quot;'&quot;,&quot;'&quot;,1,-1,1)%>) \n Are you sure you want to proceed?&quot;)){
document.forms[0].deleteMe.value = &quot;DELETE&quot;;
document.forms[0].submit();
}
return;
}

//-->
</script>

</body>
</html>

<% end if %>

Thanks to anyone who can help. I couldn't find any other question like this and I'm at the end of my resources!!

Von
 
I keep getting this error message when I try to edit a record in my database of employees

rsRecords.Open sql, Conn, adOpenKeyset, adLockReadOnly, adCmdText

faq333-618
penny1.gif
penny1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top