Introduction.
No matter what kind of database design you create for your company, the ultimate output that external users expect is reports—whether in text format or as charts. Charts can be presented in simple 2D designs or in more polished 3D designs with gradient colors. While appearance can make reports more attractive, what truly matters is that the information presented is meaningful and serves its purpose.
Think of it like a song: the lyrics may be the same whether sung by an amateur in the bathroom or by a professional singer, but the audience will always prefer the professional version. The same principle applies to reports.
You can throw together a report in a few minutes. Or you can carefully design it, paying attention to every detail—control placement, sizing, font style, highlighting, headings, footers, and summary lines. This may take hours of refinement, but the result is worth it when you present the report and see your boss’s nod of approval.
Now, speaking of controls and enhancements—why not take it one step further? For instance, you can add a watermark (such as a company logo or name) to the report’s background. This small touch gives your report a professional polish. If you have a light grayscale image of your company logo (in .bmp format), you can easily apply it as a watermark to enhance the presentation.
Incorporating a Watermark on the Report.
- Open the Report in Design View.
- Display the Report's Property Sheet (F4).
- Look for the Picture Property and select the Property.
- Click on the Build button (...), at the right end of the property, to browse for the Watermark image on the disk and select it.
- With the following three property settings of the Report, you can display and print the watermark image in various ways:
- PictureAlignment = 2 (center)
- PictureTiling = False
- PictureSizeMode = 3 (zoom)
When you load the Watermark picture in the background, with the above property settings, the Report Print Preview looks like the image given below:
Print the Report on the Printer or convert it into MS-Access Snapshot format (file extension: .snp) or into PDF.
The above work can be automated to define and assign the Watermark Image at the run-time of the Report, with the VBA Code given below:
The ReportWaterMark() Function.
Public Function ReportWaterMark()
Dim rpt As Report, txtRpt As String
Dim imgPath As String
txtRprt = ""
imgPath = ""
Do While txtRpt = "" Or imgPath = ""
If txtRpt = "" Then
txtRpt = Nz(InputBox("Give Report Name:", "Report Water Mark"), "")
End If
If imgPath = "" Then
imgPath = Nz(InputBox("Watermark Image PathName:", "Report Water Mark"), "")
End If
Loop
DoCmd.OpenReport txtRpt, acViewDesign
Set rpt = Reports(txtRpt)
With rpt
.Picture = imgPath
.PictureAlignment = 2
.PictureTiling = False
.PictureSizeMode = 3
End With
DoCmd.Close acReport, txtRpt, acSaveYes
Set rpt = Nothing
DoCmd.OpenReport txtRpt, acViewPreview
End FunctionCopy and paste the above code into a Standard VBA Module and save the code. You can run this program from a Command Button Click Event Procedure like:
Private Sub cmdWMark_Click()
ReportWaterMark
End SubWhen you run the main program, it will prompt you for two inputs: the report name and the location of the watermark image (including the file name). Be sure to note down this information before running the program. You only need to run the program once for a given report; the image will remain as the background picture till you run it again to replace the image with a different one.
Try the following property settings to see how they appear in the Report Print Preview:
.PictureAlignment = 0
.PictureTiling = True
.PictureSizeMode = 0.PictureAlignment = 2
.PictureTiling = False
.PictureSizeMode = 1









No comments:
Post a Comment
Comments subject to moderation before publishing.