Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What do you mean calling OPEN is Invalid if it is CLOSED?
Message
 
 
To
All
General information
Forum:
Visual Basic
Category:
Database DAO/RDO/ODBC/ADO
Title:
What do you mean calling OPEN is Invalid if it is CLOSED?
Miscellaneous
Thread ID:
00405178
Message ID:
00405178
Views:
52
I am getting the following error when I try to open an ADO Recordset

Run-Time error 3709.
Operation is not allowed on an object referencing a closed or invalid connection.

This doesn't happen every time either. But when I check rsMine.State it is 0 (closed) and it is a valid recordset because it works the first time and it is a read only recordset so I can't change it.

Here is the function that screws up.
Public Function LoadComboBox(rsMine As ADODB.Recordset, cboBox As ComboBox)
   With cboBox
      .Clear
      If rsMine.State = 0 Then rsMine.Open
      While Not rsMine.EOF
         If Not IsNull(rsMine!Name) Then
            .AddItem rsMine!Name
            .ItemData(.NewIndex) = rsMine!ID
         End If
         rsMine.MoveNext
      Wend
   End With
   Set rsMine = Nothing
End Function
Next
Reply
Map
View

Click here to load this message in the networking platform