S
Simon Harris
Hi All,
I'm trying to set the recordsource of a report.
Heres what I have:
DoCmd.OpenReport "RPT_currently_viewed_customers", acViewPreview
Set rpt = Reports("RPT_currently_viewed_customers")
rpt.RecordSource = Forms!frm_switchboard!SUBFRM_view_customers.RowSource
This runs, but I get the following error:
Run-time error '2191':
You can't set the record source property in print preview of after
printing has started.
So, I thought Ok, fair enough - I'll set the recordsource property before I
open the report, and changed the code to:
Set rpt = Reports("RPT_currently_viewed_customers")
rpt.RecordSource = Forms!frm_switchboard!SUBFRM_view_customers.RowSource
DoCmd.OpenReport "RPT_currently_viewed_customers", acViewPreview
Which gives me this error:
run-time error '2451':
The report name 'RPT_currently_viewed_customers' you entered is
mispelled or refers to a report that isn't open or doesn't exist.'
I'm Confused! Please help if you can!
Regards,
Simon.
--
-
* Please reply to group for the benefit of all
* Found the answer to your own question? Post it!
* Get a useful reply to one of your posts?...post an answer to another one
* Search first, post later : http://www.google.co.uk/groups
* Want my email address? Ask me in a post...Cos2MuchSpamMakesUFat!
I'm trying to set the recordsource of a report.
Heres what I have:
DoCmd.OpenReport "RPT_currently_viewed_customers", acViewPreview
Set rpt = Reports("RPT_currently_viewed_customers")
rpt.RecordSource = Forms!frm_switchboard!SUBFRM_view_customers.RowSource
This runs, but I get the following error:
Run-time error '2191':
You can't set the record source property in print preview of after
printing has started.
So, I thought Ok, fair enough - I'll set the recordsource property before I
open the report, and changed the code to:
Set rpt = Reports("RPT_currently_viewed_customers")
rpt.RecordSource = Forms!frm_switchboard!SUBFRM_view_customers.RowSource
DoCmd.OpenReport "RPT_currently_viewed_customers", acViewPreview
Which gives me this error:
run-time error '2451':
The report name 'RPT_currently_viewed_customers' you entered is
mispelled or refers to a report that isn't open or doesn't exist.'
I'm Confused! Please help if you can!
Regards,
Simon.
--
-
* Please reply to group for the benefit of all
* Found the answer to your own question? Post it!
* Get a useful reply to one of your posts?...post an answer to another one
* Search first, post later : http://www.google.co.uk/groups
* Want my email address? Ask me in a post...Cos2MuchSpamMakesUFat!