Changing Closed Report's control's ControlSource

bd528

Registered User.
Local time
Today, 02:18
Joined
May 7, 2012
Messages
111
Hi,

I have a report that I open via a button that I'd like to use as a template.

I've been able to change the recordsource, etc. Where I'm struggling is the controls.

If I don't set the Controlsources, Access asks for them via parameter. If I just click okay, the report opens as expected.

If I change the Controlsources via VBA :-

Code:
Reports!rpt2Cols.rpt2ColsDetail1.ControlSource = "Region"
Reports!rpt2Cols.rpt2ColsDetail2.ControlSource = "CountOfRegion"

exactly the same thing happens.

Does anyone know how to get the report to open without having to open the parameters?

Thanks in advance
 
I tried changing the record source in the Report open and load events and I don't get prompted for parameters unless the field names are different. If they are different you can change the control source something like:

Code:
Me.RecordSource = "Table2"
Me.F2.ControlSource = "F23"

which you can see work in the attached database.
 

Attachments

I tried changing the record source in the Report open and load events and I don't get prompted for parameters unless the field names are different. If they are different you can change the control source something like:

Code:
Me.RecordSource = "Table2"
Me.F2.ControlSource = "F23"

which you can see work in the attached database.

This issue I have is that I'm not running the code in the open and load events.

I have a "report dashboard", with around 30 different reports. Around half follow the same report structure, so I want to use a report template for all 15.

My thinking was to change the report's properties upon clicking the report's button on the dashboard. This all works fine, apart from setting the control sources.
 
Urgh - figured it out. I created my template from a copy of one of the other reports. I had left the control sources as bound. Setting them as unbound allowed be to change the control source with :-

Code:
Reports!rpt2Cols.rpt2ColsDetail1.ControlSource = "qryAbortRegion.Region"
Reports!rpt2Cols.rpt2ColsDetail2.ControlSource = "qryAbortRegion.CountOfRegion"
 

Users who are viewing this thread

Back
Top Bottom