Re: Operation not allowed when object is closed




"Jennifer" <jennifer1970@xxxxxxxxxxx> wrote in message
news:1139346915.471660.203190@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I am having problems trying to debug the message "Operation not allowed
when object is closed.". As far as I can tell the object in question
is open. Below is the code.

The error lies on the line " If RS.EOF = False Then ". Right before
that line I open the recordset.

While Not RSB.EOF
sBV = RSB("VendorCode").Value
RS.Open "EXEC sp_imOrdersToBePolled '" & sBV & "'", CN

If RS.EOF = False Then '<<---This is where the error is.
SYGFilePath = "C:\Out\Order" & StripSpecialChars(sBV) & "." &
UnitNumber
'......
'......more code here
'......

End If
Loop


Two ideas.

1. The line RS.Open "EXEC...." is inside the loop. There is no RS.Close inside
the loop. Maybe the error is occurring because you are opening the recordset
again without closing it first?

2. You are actually executing a stored procedure, not running a select query.
Maybe no recordset is returned by that procedure, so the recordset is never
actually opened. What is the RS.State property value after the Open call?



.



Relevant Pages

  • Re: vbscript logon script getting return data from sql sp
    ... Loop ... > One way to retrieve values from a stored procedure is with a Recordset ...
    (microsoft.public.scripting.vbscript)
  • Re: vbscript logon script getting return data from sql sp
    ... > One way to retrieve values from a stored procedure is with a Recordset ... then the Do Until adoRecordset.EOF loop above loops ...
    (microsoft.public.scripting.vbscript)
  • Retrieve ALL tables from ALL Databases
    ... I'm looking to create a stored procedure to first "select name from ... but the master sys.databases recordset ... It's the loop I can't get to work. ...
    (comp.databases.ms-sqlserver)
  • Re: Cursors... whats the alternative?
    ... my reason for the cursor is so i can use the recordset. ... you say to generate a recordset in the stored procedure.... ... If i could open recsets in the sp and loop ... > Well, without getting to involved in reading your stored procedure, one ...
    (microsoft.public.sqlserver.programming)
  • Re: DAO MUCH faster than ADO in this test
    ... DAO is well-known to be faster than ADO. ... Of course the DAO loop ran faster than the SQL loop; ... advantage of a table-type recordset, which only works on local tables. ... Dim starttime As Single, finishtime As Single ...
    (microsoft.public.access.modulesdaovba)