acViewPreview does not print subform

allisonrja

New member
Local time
Today, 03:17
Joined
Jun 2, 2011
Messages
2
I have a report with three subreports. I have code that determines which subreport to show. The code changes the visible property, true for the subreport to show and false for the subreports to not show.

I have a button on a form that opens the report.
I've tried both of these.

1) DoCmd.OpenReport strDocName, acViewPreview
This command shows the report correctly, however when I then select print the first subreport prints but the second and third subreport do not print. The code changes the visible property.

2) DoCmd.OpenReport strDocName, acViewNormal
This command prints the report correctly, to PDF or a printer directly.

The bottom line, the report works when printed directly however if first previewed then printed the report does not print correclty.

Any clues as to why?

Thanks,
Rick
 
I have a similar report with 2 subreports. One of the subreports is hidden by code when the report opens in print preview - depending on a value in the form that opens the report.

I just tested printing and the report prints correctly with the correct and visible subreport each time. This is an A2007 database.

What code are you using to control which subreport is visible?
 
I am using Access 2007. Behavior shows in Access 2003 and 2010 as well.
I'm working with Access 2003 based code.

The code I use to show the subreport is this:
Me!rsubScribeSheetFAST.Visible = True
The code runs in the detail_print subroutine. I tried the detail_format subroutine with similar results.

What's strange is if I comment out all code, all three subforms show in print preview. However when I print only one subform shows. Honestly there is no code hiding anything at that time. I have set the visible property to Yes for everything.

Just plain weird if you ask me. There's has to be something, however I cannot find it.
 
I have a report where I want to change which subform is visible.
I use the report load event to do this.
Here is my code
Code start------------------
Private Sub Report_Load()
If Me.IsMarketingInvoice = True Then
Me.rsubOrchard.Visible = False
Me.rsubMarketing.Visible = True
Else
Me.rsubOrchard.Visible = True
Me.rsubMarketing.Visible = False
End If
End Sub
Code end-----------------------

One sub report fits exactly on top of the other report, so only one of them can be seen.
The code I posted above, chooses which subform will be seen and printed.
 

Users who are viewing this thread

Back
Top Bottom