Remove Report Footer (1 Viewer)

Sevn

I trust ME!
Local time
Today, 06:05
Joined
Mar 13, 2008
Messages
97
Hello all,

I'm back for more help. Any assistance is greatly appreciated.

Currently; I have a sales report, that has 10 markets. In the report footer, I have the total numbers (wow, real complex isn't it). I have a small piece of VBA written, that will run the report, and export to PDF each market. So when ran; the end result is 10 PDFs, with one market per PDF.

What I would like to do is...
  • If the report is ran as a complete summary report, with all markets; I would like to retain the report footer.
  • If the report is ran as an itemized report, with each market being a separate PDF; I would like to disable/hide the report footer. I want to do this because the footer is useless, if there is only one market (market & total are the same).

I have most of what I need already, but need to know if hiding/disabling the report footer is possible. If so; I just need the VBA string that controls this function (example: ReportFooterVisible = False).

Again; any assistance with this, will be greatly appreciated.
 
Last edited:

boblarson

Smeghead
Local time
Today, 04:05
Joined
Jan 12, 2001
Messages
32,059
If you haven't renamed the Report Footer section, it would be exactly this code:
Code:
Me.Section("ReportFooter").Visible = False
 

Sevn

I trust ME!
Local time
Today, 06:05
Joined
Mar 13, 2008
Messages
97
Thanks BL.

This appears to be code use for an OnOpen event of the report (me.section). I will be executing my code from a command button on a menu. Here's a better explanation, and some sample code.

First; I will process each individual product group without the footer. Then I will process the report with all product groups, including the footer.

Code:
Private Sub Command50_Click()

Dim Rs As DAO.Recordset
Dim strProdGrp As String
Dim strProdGrpName As String

'Export by Product Group
Set Rs = CurrentDb.OpenRecordset("SELECT [rptQry-Grp].ProdGrp, [rptQry-Grp].ProdGrpName FROM [rptQry-Grp];")

Do Until Rs.EOF
strProdGrp = Rs("ProdGrp")
strProdGrpName = Rs("ProdGrpName")

DoCmd.OpenReport "rpt-Grp", acViewReport, , "ProdGrp = '" & strProdGrp & "'", acWindowNormal
DoCmd.OutputTo acOutputReport, "rpt-Grp", acFormatPDF, "C:\blah\Exports\" & strProdGrpName & ".pdf", , , , acExportQualityPrint
Rs.MoveNext
Loop

'Export summary with footer
DoCmd.OpenReport "rpt-Grp", acViewReport, , , acWindowNormal
DoCmd.OutputTo acOutputReport, "rpt-Grp", acFormatPDF, "C:\blah\Exports\rpt-Grp(C&I).pdf", , , , acExportQualityPrint

End Sub

I need to know where to add your suggestion, before or after the OpenReport string?
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 11:05
Joined
Sep 12, 2006
Messages
15,614
but all bob is saying is, thats the code you need, somewhere in the report

one way of getting this information within the report is to pass the report an appropriate openargs value to indicate whether the footer is to be hidden. (there is an openargs for reports isnt there?)
 

Sevn

I trust ME!
Local time
Today, 06:05
Joined
Mar 13, 2008
Messages
97
I'm not sure what you mean by "pass the report an appropriate openargs value". I'm still new at this, and have only passed field values to my reports. Not sure what an open arguement is.

Is this what he means?

DoCmd.OpenReport "rpt-Grp", acViewReport, , "ProdGrp = '" & strProdGrp & "'", acWindowNormal, Me.Section("ReportFooter").Visible = False

With Me.Section("ReportFooter").Visible = False being the OpenArgs
 

boblarson

Smeghead
Local time
Today, 04:05
Joined
Jan 12, 2001
Messages
32,059
I'm not sure what you mean by "pass the report an appropriate openargs value". I'm still new at this, and have only passed field values to my reports. Not sure what an open arguement is.

Is this what he means?

DoCmd.OpenReport "rpt-Grp", acViewReport, , "ProdGrp = '" & strProdGrp & "'", acWindowNormal, Me.Section("ReportFooter").Visible = False

With Me.Section("ReportFooter").Visible = False being the OpenArgs

No, just pass something like "FALSE" like this:
Code:
DoCmd.OpenReport "rpt-Grp", acViewReport, , "ProdGrp = '" & strProdGrp & "'", acWindowNormal, "False"
And then in the code of the Report's On Open Event put:

Code:
If Me.OpenArgs = "False" Then
   Me.Section("ReportFooter").Visible = False
End If
Then if False is passed then it won't include the footer, but if you open the report with "True" as the argument, it will just process like normal. You might even get away without having to include the "True" part for opening normal.
 

Sevn

I trust ME!
Local time
Today, 06:05
Joined
Mar 13, 2008
Messages
97
Ok, I get it.

Thanks a million. You guys are all so helpful, and I appreciate all your help.
 

Users who are viewing this thread

Top Bottom