Ms-Access Advanced VBA Programming Techniques, Tips and Tricks.

Textbox And Label Inner Margins

Let it be a Form or Report, a good design will always catch the eye of the User and the onlooker alike. We all design them, but if we give the same Report or Form to five different people to design, they all will do it differently based on their individual skill and tastes, unless they all use the same built in wizards.

The user may give importance mainly to the information contained in a Report and insist only on getting it in the right order and layout. But, how to present this to him/her is your responsibility alone and depends on how much time you have to work on it. You will be designing a Report only once and it is part of your Project, how you do it is your own choice.

Your Report may also travel to places through Faxes or E-mails and likely to have a wider audience to it. Where-ever it goes I expect some one to ask who designed it when compared with other Reports floating around. Luckily, MS-Access has all the right Tools you need for designing strikingly beautiful Reports or Forms. Little more of your time and imagination can do wonders with simple tools available in Access.

Here, I would like to introduce you to few Properties of Text Boxes and Labels on a Report and how simple design changes can transform it into a nice looking Report. The following is an image of a Tabular Report designed with the Report Wizard of MS-Access.

Wizards are very good in laying out all the objects quickly on Forms or Reports with default formatting of Font Type, Size, Style and saves a fair amount of design time. All you need to do is to modify them to your liking.

If you would like to try out this simple design step by step then you may Import the Shippers Table from C:\Program Files\Microsoft Office\Office11\Samples\Northwind.mdb MS-Access sample Database. The location address shown here is for MS-Access2003. If your Version of Access is different then look for change in \Office11\ part of the address. After importing click on the Table and select Report from Insert menu and select Auto Report: Tabular from the displayed options. The above Report will be created in no time. An image of the above Report in Print Preview is given below:

The modified version of the same Report in Print Preview below:

The transformation was easy with only few changes to the above design and I know what change you have noticed first. If I have turned on the borders of the Text Boxes and Labels alone then the Print Preview will look like the one below:

Make the following changes to the above design:

  1. Delete the thick line under the Header Labels.
  2. Point the Mouse on the vertical ruler to the left of the Header Label Shippers, so that it turns into an Arrow pointing to the right, and then Click and drag along the ruler downwards so that you could select all the Labels and Text Boxes in the Report Header, Page Header and Detail Sections together.

    Alternatively you can click on an empty area of the Report and drag the Mouse over all the controls to select them. Do not select the Page Footer Section Controls. We don't need them on this Report.

  3. Display the Property Sheet (View- -> Properties) and change the following Values:
    • Border Color = 9868950
    • Special Effect = Flat
    • Border Style = Solid
    • Border Width = Hairline

    You need to change only the Border Color Value, others will be there as default, if not then change them as given above.

  4. Select all the Field Header Labels alone in the Page Header Section, as we did in Step-2 above. Select Format- - > Align - -> Left to arrange the labels close together horizontally without leaving gaps between them.
  5. Display the Property Sheet of the selected Labels (View - -> Properties) and change the Top Property Value to 0 and Height Property Value to 0.4167"
  6. Centralize the Text horizontally within the Labels by changing the Text Align Property Value to Center, while all the Labels are still in selected state.
  7. Select all the Text Boxes in the Detail Section together and select Format- - > Align - -> Left to arrange the Text Boxes close together without leaving gaps between them.
  8. Display the Property Sheet of the Text Boxes (if you have already closed it) and change the Top Property Value to 0 and the Height Property Value to .2917" so that the data lines are not too close and crowded when Previewed/Printed.
  9. If there is gap below the Labels in the Page Header Section and below the Text Boxes in the Detail Section then close them by dragging up the Detail Section Header and the Page Footer Bars.
  10. Delete all the Page Footer Section controls. Close the gap by dragging the Report Footer Bar up.
  11. Now we must resize the Report Header Label with the Shippers heading and make it as wide as the width of all Field Header labels in the Page Header Section put together. You can either do it by resizing manually with your eyes as guide. Or display the Property Sheet of all the Header Labels one by one and take the Width Property Value of each label and add up to get the total of all and change the Width Property Value of the Shippers heading label.
  12. Change the Height Property Value to 0.416 and the Text Align Property Value to Center.
  13. Save your Report with a Name of your choice.

    With the above modifications the Report will look like the image given below, when Print Previewed.


The Report looks good, but with few more cosmetic changes it will look even better.

  1. The Field Header Labels' Text must be vertically centered.
  2. The Shipper ID Numbers and other field values are too close to the Border Line and they should be positioned little away from the border.
  3. Open the Report in Design View and select all the Field Header Labels together as we did earlier.
  4. Display the Property Sheet and drag the right scroll bar of the Property Sheet down to the bottom. There you will find the Inner Margin Properties that you can use to position the Text within the Controls.

    NB: These Properties are available only in MS-Access2000 and later versions.

  5. Change the Top Margin Property Value of Header Labels to 0.1?
  6. Select the Text Controls together on the Detail Section and change the Top Margin Property Value to 0.0701".
  7. Select the Shipper ID Text Box in the Detail Section and change the Right Margin value to 0.1?
  8. Select the Company Name Text Box and change the Left Margin Value to 0.0597? and set the same Left Margin Value for Phone Number also.
  9. Save your Report and open it in Print Preview. It will look like the 3rd Image from Top of this page.

Even though it took lengthy steps to explain it, you can do it quickly in a few minutes, when you know what to do to get what you want.


1 comment:

  1. Nice fill someone in on and this post helped me alot in my college assignement. Thanks you on your information.



Popular Posts

Search This Blog

Blog Archive

Powered by Blogger.


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

Featured Post

Important Notice

Dear Readers, Very sorry to inform you that I am finding it difficult to renew my contract with the Hostgator Hosting Plans to continue prov...


Blog Archive

Recent Posts