>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
>
Can you build a simple example that replicate your problem (using NWind or Biblio MDB) so that I can trace it?
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com