MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.
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