I have a report based on query that is built dynamically at runtime. Because of the dynamic nature of the SQL, the report is modified at runtime to adjust the group levels and create the proper field references.
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:
Comp2SQL is a string function that returns the SQL behind the Comp2 query.
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.
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:
Code:
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.
Comment