Adding note to all reports

  • Thread starter Thread starter Todd
  • Start date Start date
T

Todd

I've got a database which has about 20 or 30 reports. I'd
like for a note to appear (ideally in the page footer) for
all the reports. Something like "For Information Only".

I know how to add text to an individual report page
footer. However, I'm wondering if there is a way to do
this easily for all the reports so that I don't have to
open every one and add the info. Plus I want this note to
appear on all future reports also if possible.

Can anyone help?
 
I would create a small subreport that can be inserted into each report. Then
if you update the subreport, each main report will reflect the change. If
you only have 20-30 reports, it is probably easier to open each in design
view and drag the subreport into the page footer.
 
Here's some code which you can paste into a module in your database.

You will need to change the height, width and text of the label to suit what
you want.

I suggest that the first time you run it, you put an apostrophe in front of
the line that saves and closes each report so that you can check if it is
what you want and if it isn't, close the reports without saving them.



Function CmTwip(sngNum As Single) As Single
'changes a cm measurement into twips
Dim Twp As Single
Twp = 566.93
'num of twips in 1 cm
CmTwip = sngNum * Twp
End Function


Sub AddControlToAllReports()
Dim db As Database
Dim ctr As Container
Dim MyControl As Control
Dim doc As Document
Dim RptName As String
Dim MyLabel As Control
Dim Lft As Double
Dim Tp As Double
Dim Wid As Double
Dim Ht As Double
Dim a As Double
Dim Txt As String


Lft = CmTwip(0.8)
'left position of control in cm
Tp = CmTwip(0.6)
'Top position of the control in cm
Wid = CmTwip(5)
'width of control in cm
Ht = CmTwip(0.5)
'height of control in cm
Txt = "What I want to write in my label"
'the text you want in the text box

Set db = CurrentDb
Set ctr = db.Containers!Reports
For Each doc In ctr.Documents
RptName = doc.Name
DoCmd.OpenReport RptName, acViewDesign

'check if control is already there
For Each MyControl In Reports(RptName).Controls
If MyControl.Name = "lblFootNote" Then
GoTo AlreadyThere
End If
Next MyControl
Set MyLabel = CreateReportControl(RptName, acLabel, acPageFooter, , ,
Lft, Tp, Wid, Ht)
MyLabel.Properties("Name") = "lblFootNote"
'name of the label
MyLabel.Properties("Caption") = Txt
AlreadyThere:
DoCmd.Close acReport, RptName, acSaveYes
'close the report
Next doc
End Sub


If you want to try the code out on just one report then put an apostrophe in
front of the lines
For Each doc In ctr.Documents
RptName = doc.Name
Next doc

then, just under where it says RptName=doc.Name type in

RptName = "TheNameOfOneOfYourReports"

Evi
 
Darn, that is such a better idea!!
Evi

Duane Hookom said:
I would create a small subreport that can be inserted into each report. Then
if you update the subreport, each main report will reflect the change. If
you only have 20-30 reports, it is probably easier to open each in design
view and drag the subreport into the page footer.
 
This sounds good, and I like that I can change the
subreport and have it update all reports.
But...
How do I actually do this?
Is creating a subreport any different than creating a
report?
I tried creating a report and dragging it into another
reports footer, but all it gave me was the name of the
report, not the text in the report.

Should I put the note that I want to appear in the reports
footer, into the footer of the subreport, or the detail
section or does it matter.

I appreciate the help.
 
A subreport is a report. Adding the report as a control on another report
makes it into a subreport. When you drag the subreport onto the report, it
will by default, add a caption/label which you should delete. The subreport
need only have a single text box or label in the detail section.
 
Back
Top