title: Operation not allowed when the object is closed in VB6
body: <p>I know it's kind of old, but I am developing an application on VB6.
  I can't undestand why I am getting this error.</p>
  <pre><code>DSN = &quot;DatabaseInfo&quot;
      
  Dim Prod As Variant, Pal As Variant, Row As Long
  
  If Grid.DataRowCnt &gt; 0 Then
      For Row = 1 To Grid.DataRowCnt
          Grid.GetText 1, Row, Prod 
          Grid.GetText 11, Row, Pal
              
          Query = &quot;SET NOCOUNT ON UPDATE myTable SET Pal='&quot; &amp; Pal &amp; &quot;'WHERE RTRIM(Prod)='&quot; &amp; Prod &amp; &quot;'&quot;
  
          rsReg.Open Query, DSN, adOpenStatic
          Set rsReg= Nothing
      Next Row 
  End If
  rsReg.Close
  MsgBox &quot;You've done it!&quot;, vbInformation
  </code></pre>
  <p>I even tried to use the <code>SET NOCOUNT ON</code>, but it still doesn't work.
  Thank you in advance for any advice.</p>