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

Operation is not allowed when the object is closed

Status
Not open for further replies.

lazydays

Technical User
Sep 29, 2003
93
GB
I am getting the following error message.

ADODB.Recordset error '800a0e78'
Operation is not allowed when the object is closed.

It updates the table and displays the message so I don't know what is wrong with it.
When I comment out
objRS.Close
Set objRS = Nothing
it works fine.

Any help would be gratefully received.


<%
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & Server.MapPath("Passwords.mdb")
objConn.Open

Dim objRS, strSQL
strSQL = "INSERT INTO tblTemporaryEmailUpdates ( ContactName, CompanyName, Email, Website )" & _
"SELECT tblEmailUpdates.ContactName, tblEmailUpdates.CompanyName, tblEmailUpdates.Email, " & _
"tblEmailUpdates.Website " & _
"FROM tblEmailUpdates;"

Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open strSQL, objConn

Response.Write "Update Complete"

objRS.Close
Set objRS = Nothing

objConn.Close
Set objConn = Nothing
%>
 
Your trying to set the object to nothing when youve closed it.

Reverse it.

- FateFirst
 
Sorry, ignore the reverse it bit. dont know why i put that there.

- FateFirst
 
no RS is needed for an INSERT or UPDATE


use objConn.Execute(strSQL)

and remove the objRS references.



Chris.

Indifference will be the downfall of mankind, but who cares?
A website that proves the cobblers kids adage.
Nightclub counting systems

So long, and thanks for all the fish.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top