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

ADO SQL "Object Closed" Error

Status
Not open for further replies.

MJPPaba

MIS
May 28, 2003
142
GB
I am receiving an error message that I am not quite sure why.

In a constants module I have my connection string to an ADO-SQL Server 7 table, I have changed some details to protect the innocent.. please help.

Public Const myCostsConn As String = "Provider=SQLOLEDB;Initial Catalog=dbase;Data Source=server;User ID=userid;Password=password;"

In the procedure being called I have...
Sub btn_ChangeCostsData_Click()
Dim myADOConn As ADODB.Connection
Dim myADORs As ADODB.Recordset
Dim mySQL As String

Set myADOConn = New ADODB.Connection
Set myADORs = New ADODB.Recordset

mySQL = "Exec mySProc"
myADOConn.Open myCostsConn
myADORs.Open Source:=mySQL, ActiveConnection:=myADOConn

If Not (myADORs.BOF Or myADORs.EOF) Then

on the last line I get the debug error message ...
"Operation is not allowed when the object is closed."

MSDN tells me to check the state of the connection, but it is showing as open (1)

I just dont know, because even more strangely the code worked last night?

Any help greatly appreciated.

cheers

Matt

crazy times call for crazy people


CrazyPabs

Is it lunchtime yet?
 
Sorry everyone, I have posted this in the VBA Coding section rather than here. This was done in haste and by accident.

Cheers

Matt

crazy times call for crazy people


CrazyPabs

Is it lunchtime yet?
 
You could redflag it to delete explaining the reason

________________________________________
Zameer Abdulla
Visit Me
There is only one perfect child in this world. Every mother has it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top