Subreports not printing

howardshulman

New member
Local time
Today, 09:27
Joined
Jan 13, 2015
Messages
5
I have a problem that is driving me crazy (which is actually a short drive). I have a report with one sub-report. It previews correctly and prints correctly from my ACCDB. However, when I create an ACCDE, the sub-report previews correctly and then does not print. I have tried the following and none work:

  1. In the main report, deleted the links and changed the subreports record source.
  2. Changed layout for print to no
  3. Changed filter on empty matches to no
  4. Moved everything from detail to page header
  5. When I put code in the subreport to set a flag when loaded and queried that flag in the main report, the subreport never admitted to being loaded when run from the ACCDE (again works fine from the ACCDB).
I'm old and don't have much hair left and this is causing me to pull out the little hair I have left. Help!
Howard
 
1. Thank you for the link, but I can't seem to access it.
2. Some more details on the problem

  1. I am opening the report in preview mode
  2. I have a right click menu that tries to print the report using the following code:[FONT=&quot]
    If Not c_prtPrinter Is Nothing Then[/FONT]
    [FONT=&quot]
    Set Printer = c_prtPrinter[/FONT]
    [FONT=&quot]
    End If[/FONT]
    [FONT=&quot]
    DoCmd.PrintOut[/FONT]
  3. I have a tried closing the preview and using OutputTo
  4. I have tried closing the preview and reopening in report mode and then using printout.
  5. Interestingly, when I open the report in preview mode and hidden and then immediately execute the code in 2 above, it works.
  6. The same thing happens when I try to use OutputTo to create a PDF (does not work from right click menu, works using mode in 5 above).
 
Below is what the link pointed to:

VBA Code Does Not Work On ACCDE File
I once have experienced the very strange behavior of MS Access 2007, the one that didn't exist in the previous version. The strange thing was that after I did the coding and then I made ACCDE fie (figure 1), all of the event of VBA code in the compiled MS Access DB didn't work. While the original ACCDB file worked OK.


Figure 1: Make ACCED File First I thought, there must be something wrong with my code. I looked everywhere, none seemed to be a problem.

I searched on the internet to see who used to have the same problem. It seemed like nobody did have this problem. Then I came accross one forum, and I found the solution for this. The reason why nobody faced the same problem might be that I missed the very fundamental 101 in MS Access 2007 thing that need to be done. However, this has never been a problem for me when I used MS Access 2003 or MS Access 97. And yes, my problem was resolved.

The resolution for this is ALWAYS compile VBA code before making ACCDE file. To do this, see the below instruction and screenshot.


  1. To get to the screen below just press Ctrl + G
  2. Go to menu Debug and click Compile [your MS Access database name]. In this example I use Northwind which was provided by Microsoft.

Figure 2: Compile the Database
 
Thanks, but my problem is different. Every things works, except in some circumstances, subreports to not print (or go to PDFs). See the description above.

Howard
 

Users who are viewing this thread

Back
Top Bottom