Learn Microsoft Access Advanced Programming Techniques, Tips and Tricks.

Creating Watermark on MS-Access Reports

Introduction.

No matter what kind of database design you plan for your Company, reports (in text or Chart form) are the main output the external users expect from the application. The Charts can be with 2D design or can be in pretty 3D design with gradient colors which makes them more attractive to look at. In either case the information in them must be meaningful and must serve their purposes. It is like the difference between a song sung by the bathroom singer and by a professional one. The lyrics is same but the listener definitely prefer the second choice.

You can design a report in minutes. Or you can design the same report giving personal attention to each and every control on the report for their placement, control size, font size, highlighting, heading, footer, summary lines and so on. It may take several hours before you are satisfied with the idea of presenting the report to the boss, stand back and look for the sign of appreciation appearing on his face.

Talking of controls and enhancements whey can't we place a Watermark (a Company Logo or Company Name) on the Report Background to give the report a touch of class? It will not take much to do that. If you have an Image of your Company Logo (in .bmp format) with a very light gray scale color (like the image given below) you can easily implement this idea on your Report.


Incorporating Watermark on Report.

  1. Open the Report in Design View.
  2. Display the Report's Property Sheet (F4).
  3. Look for the Picture Property and click on the property to select it.
  4. Click on the Build button (. . . at the right end of the property) to browse for the Watermark image on the disk and select it.
  5. 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 Printer or convert into MS-Access Snapshot format (.snp) or into PDF.

The above manual work made easier for any 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 Function

Copy 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 Sub

When you run the main program it will prompt for the Report Name and for the Watermark Image location with image name. You must note down these information somewhere before you attempt to run the program. You need to run this program only once for a report. The image stays as the backgroud picture on the report till you run the program again to change the image.

Try the following property settings to see how they appear on the Report Print Preview:

.PictureAlignment = 0
    .PictureTiling = True
    .PictureSizeMode = 0

.PictureAlignment = 2
    .PictureTiling = False
    .PictureSizeMode = 1
Technorati Tags:
Share:

No comments:

Post a Comment

Comments are subject to moderation before publishing.

Translate



PageRank
Subscribe in a reader
Your email address:

Delivered by FeedBurner

http://clicky.com/101199826
Blog Directory Visit blogadda.com to discover Indian blogs

Search

Popular Posts

Search This Blog

Blog Archive

Powered by Blogger.

Follow by Email

Labels

Forms Functions How Tos MS-Access Security Reports Class Module msaccess forms Animations msaccess animation Utilities msaccess controls Access and Internet MS-Access Scurity MS-Access and Internet Array Queries msaccess reports External Links msaccess tips Accesstips Downloads Objects Property Collection Object Event Menus and Toolbars Controls MsaccessLinks Process Controls WithEvents Art Work msaccess How Tos Combo Boxes Graph Charts List Boxes VBA msaccessQuery Command Buttons Dictionary Object Form Report Calculation Command Button Data Emails and Alerts Query RaiseEvent Custom Functions Custom Wizards DOS Commands Data Type Object Reference ms-access functions msaccess functions msaccess graphs msaccess reporttricks Item msaccessprocess security advanced Access Security Add Auto-Number Field Type Fields Form Instances Key Macros Menus SubForm Top Values Variables msaccess email msaccess menus progressmeter Access2007 Copy Excel Expression Join Methods Microsoft Numbering System Records Recordset Security Split Table Time Difference Utility Workgroup Wrapper Classes database function ms-access msaccess wizards reference text tutorial vba code Access2003 Accounting Year Action Animation Attachment Binary Numbers Bookmarks Budgeting ChDir Color Palette Conditional Formatting Data Filtering Defining Pages Diagram Disk Dynamic Lookup Error Handler Export External Filter Formatting Groups Hexadecimal Numbers Import Labels List Logo Macro Mail Merge Main Form Memo Monitoring Octal Numbers Operating System Paste Primary-Key Product Rank Reading Remove Rich Text Sequence SetFocus Summary Tab-Page Tables Union Query User Users Water-Mark Word automatically commands hyperlinks iSeries Date iif msaccess msaccess alerts pdf files restore switch toolbar updating upload

Featured Post

Running Sum in MS-Access Query

Introduction. We are familiar with creating Auto-Numbers in Query Column, through an earlier Function created with the Name QrySeq(), publi...

Labels

Blog Archive

Recent Posts