Printing a pdf of the master report and skip subreports with no Photo and descriptive

jeudi 30 avril 2015

I am needing some help with the subreports that contain images and text boxes.
I have a Master Report with 4 subreports. Each subreport contains 2 images and 2 text boxes.
I am trying to get the Master Report to not print the subreports if there is no descriptive text in the text boxes.
I have attached my database. I am using Access 2010.

My workflow:
1. Open Input Form
2. Use the drop down list in the upper right to select a Structure Number
3. Select the Photos tab
4. Click the Insert File button for Photo1_Path
a. Browse for a photo image. This only captures the file path and does NOT attach the image into the database.
5. Type in some descriptive text in the Photo1_Description field.
6. Save Form.
7. Open Print Form
8. Use the drop down list to select a Structure Number.
9. Click the Print to PDF button.
10. Select a location to save/output the pdf file.

Here is the location of the code that I am trying to get to function so my subreports with no descriptive text will not print.

Master Report
In the Master Report, Detail Section, I have an Event Procedure in the “On Print”.

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
If (IsNull(Reports![Master Report]![Photo1Report].Report!Photo1_Description)) Then
Reports![Master Report]![Photo1Report].Visible = True
Else
Reports![Master Report]![Photo1Report].Visible = False
End If
End Sub

I get this error: Ambiguous name detected: Detail_Print.


Photo1Report
In the Photo1Report, Report Section, I have an Event Procedure in the “On No Data”.
Private Sub Report_NoData(Cancel As Integer)
If Me.Photo1_Description.Report.HasData Then
Me.Photo1_Path.Visible = True
Else
Me.Photo1_Path.Visible = False
End If
End Sub

The Photo1Report, Detail Section, I have “Can Shrink” set to yes.
With the code for Photo1Report, I get errors when trying to use the Input Form “Insert File” for Photo1_Path.
Also, the Print to PDF button no longer finds the Structure Number and a window pops for input.


Any help is greatly appreciated.
Thank you.

Attached Files
File Type: zip Forum_Help_Database.zip (268.4 KB)
Printing a pdf of the master report and skip subreports with no Photo and descriptive

0 commentaires:

Enregistrer un commentaire

Labels