I have a form in which Users type/select the criteria for a report. There is a Preview cmd button on the form which generates a SQL string based on the User's selections and opens a recordset.
The recordset is opening and returning the correct data.
HOWEVER, I can't find a way to then open the report with the RecordSource of the report set to this recordset. I am currently using
DoCmd.OpenReport strRptName,acViewPreview to open the report.
I have tried setting the RecordSource property of the Report to strSQL (my generated SQL String) and to rsReport (the name of the recordset). Both strSQL and rsReport are set as Public variables.
I have also tried setting Me.RecordSource=rsReport in the Report_Open event but this subroutine doesn't appear to get called by the DoCmd.OpenReport...
Is there an easy fix for this that doesn't involve using Querydef???
The recordset is opening and returning the correct data.
HOWEVER, I can't find a way to then open the report with the RecordSource of the report set to this recordset. I am currently using
DoCmd.OpenReport strRptName,acViewPreview to open the report.
I have tried setting the RecordSource property of the Report to strSQL (my generated SQL String) and to rsReport (the name of the recordset). Both strSQL and rsReport are set as Public variables.
I have also tried setting Me.RecordSource=rsReport in the Report_Open event but this subroutine doesn't appear to get called by the DoCmd.OpenReport...
Is there an easy fix for this that doesn't involve using Querydef???