access 2010 vba - outputing a report to multiple pdf's Can the printing Dialog box be supressed

Anonymous
2011-12-22T19:33:27+00:00

I have a report  that is 1700 pages or more. It produces a front page and back page for each of the 170 names in the query.

It has a subreport for each Student that could vary from 1 to 17 pages.

I can output this report to a single PDF.

I have created a loop that opens the filtered report for each student and outputs a single pdf in its new or existing folder.

This all works well but whilst the loop is running,  for each report to PDF there is a 'Printing' to Dialog box appearing momentarily.

This flashes 170 times during the process.

I am using the docmd's below  

                DoCmd.OpenReport "rptreportsmain", acViewPreview, , "(tblstudents.studentid) ='" & strStudent & "'", acHidden

                DoCmd.OutputTo acOutputReport, "rptreportsmain", acFormatPDF, strFileName, 0  

Is there a way of supressing this printing dialog box whilst the loop is running.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

6 answers

Sort by: Most helpful
  1. Anonymous
    2011-12-22T21:30:55+00:00

    I am using the docmd's below  

                    DoCmd.OpenReport "rptreportsmain", acViewPreview, , "(tblstudents.studentid) ='" & strStudent & "'", acHidden

                    DoCmd.OutputTo acOutputReport, "rptreportsmain", acFormatPDF, strFileName, 0  

    Is there a way of supressing this printing dialog box whilst the loop is running.

     

    You could try adapting the code here:

        http://access.mvps.org/access/api/api0037.htm

        API: Suppress the "Printing" Dialog

    0 comments No comments
  2. Anonymous
    2011-12-22T21:50:37+00:00

    Dirk

    Yes I have looked at that but because there are so many in such a short space of time it still flashes up unless I didn't run it properly.

    In the hidden form The timer would not fire.

    0 comments No comments
  3. Anonymous
    2011-12-22T23:30:52+00:00

    Yes I have looked at that but because there are so many in such a short space of time it still flashes up unless I didn't run it properly.

     

    In the hidden form The timer would not fire.

    I can see how that might be the case.  One thing you could try would be to modify that approach as follows:

    1. Change the TimerInterval on the monitoring form to something really small; maybe as small as 1 millisecond if that works.  AND
    2. Open the form once, before you go into the report loop, and leave it open while you repeatedly open the report filtered in preview mode, output it to PDF, and close the report.  Only close the form when you exit the loop, having closed the report for the last time.

    Looking at the code, it seems to me that it can probably be run any number of times, so each time the timer fires it will look for the Printing... dialog window and minimize it.  However, it might need tinkering; for example, it may be necessary to check whether the window is already minimized.  But the idea is that the form just keeps looking for a qualifying window and minimizes it whenever it finds one, as long as the form is open.

    In my experience, when you first open a form there's a slight delay before the first firing of the Timer event, so you may need to insert a delay in your code between opening the monitoring form and entering the report loop.

    All of this is purely speculative, of course.  I haven't tried it, but it seems like a possibility.

    0 comments No comments
  4. Anonymous
    2012-01-03T09:28:58+00:00

    Dirk

    Sorry but Xmas got in the way. Happy new year

    I have now managed to get the Timer functioning properly - I did wonder about the scope of API code. Having now placed this in a public module instead of the forms vba sheet It fires properly.

    I added a counter to the timer to display in the status bar and it is firing at least 10 times for each full report that is produced.

    I didi try pausing things but to no avail.

    Currently the Print dialog appears on screen for a very very short time and then minimises.

    This causes the screen to appear blip. My loop takes alomost 3 minutes as it is reformating the report each time it loads.

    Thinking whats possible.

    Is there a way of opening a report with all 170 students then split it into individual pdfs ? (I don't think I have enough fingers to cross)

    regards

    Bruce - nebie

    0 comments No comments
  5. Anonymous
    2012-01-03T13:53:36+00:00

    Is there a way of opening a report with all 170 students then split it into individual pdfs ? (I don't think I have enough fingers to cross)

    I believe that if you have the full version of Adobe Acrobat, you can use it to split a PDF up into multiple PDFs.  I don't know any more than that, and I don't know if you can automate it.  I don't know if that presents a possibility for you or not.

    0 comments No comments