Sub to update control source of multiple reports and fields within (1 Viewer)

choaspes

Registered User.
Local time
Today, 07:48
Joined
Mar 7, 2013
Messages
78
Hi All

I have a very large collection of reports serving as template letters for different scenarios, which I want to update to use a new record source query returning different fields. To do this I would need to update the record source for each report and for each of the relevant fields within it and it seems to me that it should be possible to set up a sub that could do this for me and which I pass the names of the various reports to. Unfortunately I'm falling at the first hurdle:

Docmd.OpenReport ("MyReport")
Reports![MyReport].Report.ControlSource = "NewQuery"
...results in Run Time Error '2465': application defined or object defined error

Usually I can get there in the end with these things if I search the internet, particularly this site, enough, but I'm drawing a bit of a blank here. Is my method completely wrong?
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:48
Joined
Oct 29, 2018
Messages
21,473
Hmm, don't think reports have control source. Perhaps you meant to try RecordSource?
 

choaspes

Registered User.
Local time
Today, 07:48
Joined
Mar 7, 2013
Messages
78
Hmm, don't think reports have control source. Perhaps you meant to try RecordSource?
Duh. Solved. Thank you. End of a long week.
 

Users who are viewing this thread

Top Bottom