Transfering RecordSource/OrderBy of form to Report

jwhite

Software Developer
Local time
Today, 08:59
Joined
Sep 24, 2006
Messages
141
I have a subform within a form that displays filtered data based on dynamic selection criteria which is assigned to the RecordSource/OrderBy of the subform. On this form, I have a "Print Results" button -- OnClick, I would like the RecordSource/OrderBy of the subform to be copied to the Report, then run the report. What I have that doesn't work is:

Reports!rpt_frmTaskMain.RecordSource = Forms!frmTaskMain.frmTaskSub1.RecordSource
Reports!rpt_frmTaskMain.OrderBy = Forms!frmTaskMain.frm.TaskSub1.OrderBy

On execution I get error: "Object doesn't support this property or method"

I am thinking this can be done, and likely have the references wrong. Help?
 
Hmmph...

I figured it out.

I found the key, and then common sense kicked in telling me the report has to be open to receive the data, so I moved the lines to the OnOpen event of the report.

Reports!rpt_frmTaskMain.RecordSource = Forms!frmTaskMain!frmTaskSub1.Form.RecordSource
Reports!rpt_frmTaskMain.OrderBy = Forms!frmTaskMain!frmTaskSub1.Form.OrderBy
 

Users who are viewing this thread

Back
Top Bottom