The problem, I guess because the query isn't optimized, is that it take anywhere from 1 to 2 minutes for the code to modify the report.
I've found that if the report has no recordsource then the code can modify the report in milliseconds as expected. So I'm trying to have the report modifications in place and then set the report's recordsource. Unfortunately, I'm getting a Visul C++ Runtime Error that only says 'abnormal program termination'.
From there, Access exits.
I've tried it in all of these ways:
Expand|Select|Wrap|Line Numbers
- Reports!rptComp2.recordsource="Comp2"
- Report_rptComp2.recordsource="Comp2"
- Reports!rptComp2.recordsource= Comp2SQL
- Report_rptComp2.recordsource= Comp2SQL
Other info:
The dynamic SQL works fine.
Comp2 returns the correct data every time.
The report does open fine as long as the recordsource is set before I open the report.
The report is open in design view when I try and set the recordsource.
I'm not getting a trappable error, just the 'abnormal program termination'.
Any help on why this is happenning would be great. Thanks.