title: VBA The object you entered is not a valid recordset property
body: <p>Ok so what I am trying to do is assign a ADODB.Recordset to a ListBox in VBA. I am getting the Error: "The object you entered is not a valid recordset property".. What am I doing wrong here?</p>
  
  <p>Note: adoConn is valid and set somewhere else in the code.</p>
  
  <pre><code>Private Sub Form_Load()
  ' Error Management
  On Error GoTo ErrHandler:
  
  Dim adoRS As New ADODB.Recordset
  Dim sqlStmt As String
  
  ' Create the SQL statement
  sqlStmnt = "SELECT GroupName FROM tblGroups"
  
  ' Execute the statement
  adoRS.Open sqlStmnt, adoConn
  
  ' Add items to the lstGroups
  If (adoRS.RecordCount &lt;&gt; 0) Then
      Set lstGroups.Recordset = adoRS
  End If
  
  ' Clean up
  adoRS.Close
  Set adoRS = Nothing
  Exit Sub
  
  ErrHandler:
  ' Clean up
  If (adoRS.State = adStateOpen) Then
      adoRS.Close
  End If
  
  Set adoRS = Nothing
  
  If Err &lt;&gt; 0 Then
      MsgBox Err.Source &amp; "--&gt;" &amp; Err.Description, , "Error"
  End If
  End Sub
  </code></pre>
  
  <p>This is how ADO is opened</p>
  
  <pre><code>Public Sub openConnection()
  ' The path to the database
  Dim strDBPath As String
  strDBPath = "C:\Users\Vincent\****\****\"
  
  ' The database name to connect to
  Dim strDBName As String
  strDBName = "Permissions_be.accdb"
  
  ' Full path to the database
  Dim strDBFull As String
  strDB = strDBPath &amp; "\" &amp; strDBName
  
  ' Instantiate an ADO object
  Set adoConn = New ADODB.Connection
  
  ' Connect to database
  With adoConn
      .Provider = "Microsoft.ACE.OLEDB.12.0"
      .Mode = adModeShareDenyNone
      .Open (strDBPath &amp; strDBName)
  End With
  End Sub
  </code></pre>
  
  <p><strong>Update</strong>
  So if anyone comes across this problem on Access 2010/13.
  - Set the list box to a values list.
  - Then on the VBA side loop through the recordset</p>
  
  <pre><code>' Add items to the lstGroups
  If (adoRS.RecordCount &lt;&gt; 0) Then
  
      Do While Not adoRS.EOF
          ' This is how to add two columns to one listbox if you need only
          ' one then put only the (adoRS.Fields(0))
          lstGroups.AddItem (adoRS.Fields(0) &amp; ";" &amp; adoRS.Fields(1))
          adoRS.MoveNext
      Loop
      lstGroups.Requery
  End If
  </code></pre>