Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transfering RecordSource/OrderBy of form to Report 1

Status
Not open for further replies.

fdcusa

Technical User
Jul 27, 2006
40
US
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?
 
Thank you, Remou, for not giving me the full answer! :)

In your suggested reference 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. Works like a charm now. Thanks!

Reports!rpt_frmTaskMain.RecordSource = Forms!frmTaskMain!frmTaskSub1.Form.RecordSource
Reports!rpt_frmTaskMain.OrderBy = Forms!frmTaskMain!frmTaskSub1.Form.OrderBy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top