Let me ask the question ... Why do you want to change recordsource?
Now the answer: If you want to conditionally set the recordsource,
then set it in the Report_Open event. Pass the name of the query in
via the OpenArgs parameter of the DoCmd.OpenReport method.
If you're in Access 97 where there is no OpenArgs for Reports, then
create a public Property Get, Property Let pair (or just a public variable)
to store the value before opening the report, and then retrieve it from
the open event of the report.
This thing about opening an object in design view is whacked. It won't
work in an MDE at all and in an MDB it will create bloat.
--
Danny J. Lesandrini
dl*********@hotmail.com http://amazecreations.com
"Michael Turner" <tu****@impedimed.com> wrote ...
Hi
Can anyone tell me why I get this error message "Object doesn't support this
property or method."
at the line "Set rpt = Reports!shipping".
The funny thing, is that the same code works fine when placed behind a
button
on some forms but not others.
Dim rpt As Access.Report
DoCmd.OpenReport "shipping", acViewDesign
Set rpt = Reports!shipping
rpt.RecordSource = "qry_shippingCourier"
DoCmd.OpenReport "shipping", acPreview
Thanks in advance
Mick