Learn Microsoft Access Advanced Programming Techniques, Tips and Tricks.

Easy-Read Reports

When Computer Reports; like Accounting Ledger Statements or Purchase Invoices are printed with closely positioned lines. It is easy to read if alternate line background is shaded with a light color.  Normally, pre-printed stationery is used for this purpose. Line-Printers will print 6 lines of data within one inch space vertically.  To print headlines in bold the double-strike method is used (the hammer will strike a character twice) and this is the only printing style available besides normal method. 

A4 (8.5 x 11 inch) size paper will have 66 lines of print positions vertically. Out of this one inch top and half an inch bottom margin area is left out while printing the alternate data print positions with green color like the sample image given below:

A4 size paper have 80 print positions across, when 10 character per inch (pitch) font size is used. This can be increased to 96 characters if 12 character per inch character size is used.

These were general information about computer stationery. Reports are designed for Line Printers keeping these specifications in mind.  If necessary we can design reports with detail section height and the text box controls’ height in one-sixth of an inch in plain paper stationery.

We are going to try a small trick to print alternate print lines with shaded background so that Users can read the contents very easily. We don't need pre-printed stationery for this and we will prepare shaded background while printing the report itself.

We can design a Quick Report and write few lines of VBA Code on the class module of the Report. If you already have a Report with closely printed detail lines you can skip to step-3 given below.

  1. Import Products Table from MS-Access sample database Northwind.mdb
  2. Use the Report Wizard to design a Tabular Report with the Products Table like the sample image given below:
  3. Open the Report in Design View.
  4. Select all the controls on the Detail Section of the Report and drag them to the right to get enough space to draw a Text Box at the left side to display Serial Numbers to the Report Lines.  Drag the heading lines and position them to the right.
  5. Draw a Text Box at the left side and write the expression =1 in the Control Source Property.  Change the Name Property Value to SRL.
  6. Change the Running Sum Property Value to Over All.
  7. Create a Label control at the Page Header above the Text Box and change the Caption to SRL (for Serial Number).
  8. Select all the controls in the Detail Section together and display the Property Sheet (F4 or Alt+Enter).
  9. Change the Top Property Value to 0.  All the controls will be shifted and positioned at the top edge of Detail Section.
  10. Select the Rectangle Tool from the Toolbox and draw a rectangle around all the text boxes in the Detail Section (see the design view image above).
  11. Display the Property Sheet of Rectangle (F4) and change the Name Property Value to Box1.
  12. While the rectangle control is still in selected state select Send-to-Back Tool from Arrange Menu to position the rectangle behind the text box controls.
  13. Reduce the Detail Section height so that there is no empty space below the Text Box controls.
  14. Display the VBA Code Module of the Report (ALT+F11).
  15. Copy and paste the following lines of VBA Code into the Code Module and save the Report:
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Dim xSrl
    xSrl = [SRL]
    If xSrl / 2 = Int(xSrl / 2) Then
       [Box1].BackColor = &HCCC8C2
    Else
       [Box1].BackColor = &HFFFFFF
    End If End Sub
  16. Open the report in Print Preview.  You will find the result as shown in the report image at the top of this page.
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 How Tos Functions MS-Access Security Reports msaccess forms Animations msaccess animation Class Module 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 Menus and Toolbars Controls Event MsaccessLinks Process Controls Art Work Collection Object WithEvents msaccess How Tos Combo Boxes Graph Charts List Boxes VBA msaccessQuery Command Buttons Command Button Data Dictionary Object Emails and Alerts Form Query RaiseEvent Report Calculation Custom Wizards DOS Commands Data Type ms-access functions msaccess functions msaccess graphs msaccess reporttricks Item Object Reference msaccessprocess security advanced Access Security Add Custom Functions Field Type Fields Form Instances Key Macros Menus SubForm Top Values Variables msaccess email msaccess menus progressmeter Access2007 Auto-Number Copy Expression Join Methods Microsoft Numbering System Records Recordset Security Split Table Time Difference Utility Workgroup Wrapper Classes database 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 Excel 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 function hyperlinks iSeries Date iif msaccess msaccess alerts pdf files restore switch toolbar updating upload

Featured Post

WithEvents and All Form Control Types

Introduction So far we have worked extensively with only one type of Control: the TextBoxes on Form, enabled with Events to Raise and captu...

Labels

Blog Archive

Recent Posts