Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
Set Me.lstResults.Recordset = rs
. I am trying to get the ADO Recordset based on a SQL stored procedure to appear in an unbound Listbox or Subform of an Access form. I’m on Win 7 Machine using Access 2010 connecting to SQL Server 2008:
Set Me![frmM_SearchForDocumentsSubForm].Form.Recordset = rs
Private Sub cmdRun_Click() 'On Error Resume Next Dim strSQL As String 'Stored procedure + parameters called from form strSQL = "Exec sqlsp_searchalltables " & Me.txtTables & _ ", " & "'%" & Me.txtSearchTerm & "%'" OpenMyRecordset rs, strSQL 'debug - view procedure Me.lblQuery.Caption = strSQL Me.Repaint Set Me.lstResults.Recordset = rs 'or this 'Set Me![frmM_SearchForDocumentsSubForm].Form.Recordset = rs End Sub
With Me.lstResults Do strItem = rs.Fields("CLIENT_ID").Value .AddItem strItem rs.MoveNext Loop Until rs.EOF End With
Join the community of 500,000 technology professionals and ask your questions.