Printing a subreport within other forms (1 Viewer)

Local time
Today, 01:23
Joined
Feb 2, 2020
Messages
45
Within the "Report Center" tab, the user should choose a filter to filter the report that is in place.
I would then like to be able to print out the resulting report.
I can't seem to accomplish this as the SubReport is part of a form on a tab control.

Would love some help with the VBA to accomplish printing the subreport that is in place and ultimately also saving as PDF with same scenario.

thank you
 

Attachments

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:23
Joined
Oct 29, 2018
Messages
11,217
Hi. You should be able to simply use the OperReport method using the same filter in the WhereCondition argument.
 

HiTechCoach

Registered User.
Local time
Today, 00:23
Joined
Mar 6, 2006
Messages
4,344
I agree with theDBguy that you need to create a report to print

In the command button on the form, open a report with the form's filter.

Code:
Private Sub cmdOpenReport_Click()

If Me.Filter = "" Then
     DoCmd.OpenReport "rptCustomers", acViewPreview
Else
     DoCmd.OpenReport "rptCustomers", acViewPreview, , Me.Filter
End If
End Sub
While it is possible to embed a report on a form as a subreport, I find it best to use a form in a subform control.
 

mike60smart

Registered User.
Local time
Yesterday, 22:23
Joined
Aug 6, 2017
Messages
580
Hi Michael

In the attached I moved your Print Command Button and renamed it "Preview Report"

See if this now does what you need
 

Attachments

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom