PDA

View Full Version : Requery Subreport ?



Sowanso
04-04-2008, 12:56 AM
Hi,

I am trying to create a report which is summing up all assets and liabilities in a company. Its query is rather large and takes appoximatelly 10 seconds to perform. However after generating the report I still need to calculate few values to check if they fit into legislative limits.

Because the report query takes 10 seconds I've decided to calculate all the limits within the report while generating the report. My basic idea was to create an empty table and put all the limit values inside while generating the report and then query the table from a subreport located in a report footer. Everything went rather smooth untill I've realized that the subreports source is being queried while the report is opening. For that reason my subreport is always empty and when I close and reopen the parent report I can see all the values from its previous run.

That's why I would need to requery the subreport after the limits are being calculated (and right before the report footer containing the subreport is being processed) so that the subreport loads and prints the latest values. As I've found out a method requering subforms doesn't seem to work for subreports (or I just might not found the right syntax to requery the subreport from the parent report yet). Is it even possible?

I would greatly appreciate any help on this topic.

FrymanTCU
04-04-2008, 09:04 AM
I'm sure it is possible. I am not the best at fixing code but this would be a helpful script to learn. I would recomend you post the VBA of the code your are currently trying to use to give the more experienced users something to start with. Good Luck.

Trevor
04-05-2008, 11:01 AM
to make this a quick fix since you know the time it takes to generate the first report and it looks like you want/need to wait between the 2 reports try a timer:

Dim wait as double Declare wait
Wait = Timer 'wait set to equal timer
While Time < Wait + 15 ' Time in seconds, will wait 15 seconds before continuing code execution
DoEnvents ' Donothing
Wend