i added some Debug.Print statements after the code example
I posted, and according to what printed, the recordsets are
all open...
that works, so I am not really sure what to tell you...Code:Private Sub Command1_Click() Dim CollectCnn As ADODB.Connection Dim Collection(10) As ADODB.Recordset Dim i Set CollectCnn = New ADODB.Connection CollectCnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Archivos de programa\Microsoft Visual Studio\VB98\Nwind.mdb;Persist Security Info=False" For i = 1 To 10 Set Collection(i) = New ADODB.Recordset Collection(i).Open "Select * From Employees", CollectCnn, 3, 3 Next For i = 1 To 10 Debug.Print "Open = " & adStateOpen & " Closed = " & adStateClosed & " State = " & Collection(i).State Next MsgBox "Done!" End Sub




Reply With Quote