M
M.
What I'd like to do is to generate a pdf of a filtered report rpt for every
record in the recordset rst, based on the filter defined in the field
Report_Filter of this recordset in the following way:
'Report rpt already opened earlier in code
'Set filter condition for current record
rpt.Filter = rst!Report_Filter
'Set filteron to activate filter
rpt.FilterOn = True
'prepare path and filename to save pdf of report to on harddisk
strAttach = "c:\TEMP\" & rst!ID & ".PDF"
'Generate pdf output of filtered report and save to harddisk
DoCmd.OutputTo acOutputReport, , acFormatPDF, strAttach
This procedure works fine when I'm debugging the code line by line, so I can
see that the filter is activated and the report refreshed accordingly, but
when I run the code in full speed execution mode, the filter condition
appears to be ignored and every record gets the same (unfiltered) pdf with a
different filename.
I also noted that when I open the report every time with a different where
condition(Docmd.openreport.....), this works fine, but is very slow for my
purpose. I would like to stick with opening the report once and only updating
the filter condition to save execution time for the large recordsets that
have to be processed.
What am I missing here between debugging mode and normal execution mode that
results in this difference?
Thanks in advance,
M.
record in the recordset rst, based on the filter defined in the field
Report_Filter of this recordset in the following way:
'Report rpt already opened earlier in code
'Set filter condition for current record
rpt.Filter = rst!Report_Filter
'Set filteron to activate filter
rpt.FilterOn = True
'prepare path and filename to save pdf of report to on harddisk
strAttach = "c:\TEMP\" & rst!ID & ".PDF"
'Generate pdf output of filtered report and save to harddisk
DoCmd.OutputTo acOutputReport, , acFormatPDF, strAttach
This procedure works fine when I'm debugging the code line by line, so I can
see that the filter is activated and the report refreshed accordingly, but
when I run the code in full speed execution mode, the filter condition
appears to be ignored and every record gets the same (unfiltered) pdf with a
different filename.
I also noted that when I open the report every time with a different where
condition(Docmd.openreport.....), this works fine, but is very slow for my
purpose. I would like to stick with opening the report once and only updating
the filter condition to save execution time for the large recordsets that
have to be processed.
What am I missing here between debugging mode and normal execution mode that
results in this difference?
Thanks in advance,
M.