Microsoft Access FormsMicrosoft Access Tips to Avoid 17 Common Form Design Mistakes

by Luke Chung, President of FMS, Inc.

Introduction

Access forms are extremely powerful. However, the developer can easily make mistakes to cause a form to behave incorrectly or poorly. Here’s a simple checklist of common problems with form designs. Developers should verify these problems do not exist prior to finalizing their forms.

Avoid Common Mistakes

Check these items on your forms before you distribute them:

Verify Data Sources

Verify that the tables and queries used by the form are valid. This includes checking the form’s record source and the row source of all combo boxes and list boxes.

Use Captions

Without setting the form caption property, the name of the form appears which may not be what you want your users to see.

Spell Check

Make sure that what the user sees is accurate and spelled correctly. In addition to the labels, the user also sees validation text and control tip text. A common mistake occurs when a control with these properties is copied, and only the label and control source are changed. In this case, other properties such as validation rule, input mask, default value, format, etc. may also be wrong.

Avoid Duplicate Hotkeys

Make sure accelerator keys (hotkeys) are not duplicated. Accelerator keys allow users to use the Alt key and letter to jump to a control. They are set by using the “&” character in captions followed by the letter. For instance, a Help button may have an “H” hotkey and appear as “Help” with its caption “&Help”. A common mistake is to assign the same key to multiple controls on the form. Test your form by using each hotkey twice and verify it doesn’t go to more than one control.

Command Buttons Must have an OnClick Event

If it doesn’t have an OnClick event, the button should be removed, made invisible, or fixed. Sometimes the OnClick event is accidentally assigned to the wrong event, such as the OnDblClick event. Alternatively, an OnClick event is not necessary if it has a Hyperlink.

Verify Tab Order

Make sure the tab order of the controls is correct. By default, the tab order should go left to right, top to bottom. This is what users expect. If your form does not behave this way, it exhibits unexpected (unintuitive) behavior which can be frustrating for your users. The default tab order can be easily set under the View, Tab Order menu. For situations where you want the tab order to behave differently (for instance, you may want it to go down columns for an option group), you can change this, but at least you’re making a deliberate decision to deviate from the default order.

Explicitly Set the Allowed Views

Views Allowed should be explicitly assigned to only display the way you want your users to see the form. Options include viewing the form in form view, datasheet view, and in Access 2002, PivotChart and PivotTable views. Without the undesirable options turned off, a user can change the view of the form by right clicking on the form and switching with the shortcut menu.

Verify Shortcut Menu Setting

By default, the Shortcut menu property is set to Yes, and no shortcut menu is specified. This means Access’ default menu appears. If this is not desired, set this property to No.

Verify Help File Context IDs

If you are using a help file, make sure the help file name and help context ID are correct.

Avoid Missing Code

Make sure every event that has [Event Procedure] assigned actually has an event procedure defined. A common mistake is to assign the event without actually clicking through to write the code for it. This can also happen if you rename a control and forget to rename the event procedures tied to the old name.

Set AutoCenter to Yes

Make sure the AutoCenter property is set to Yes. AutoCenter ensures that when your form is opened, it opens in the center of the screen regardless of where you placed it when you saved it on your machine, or what the user’s screen resolution is.

Set Resize Property to Yes

Make sure the AutoResize property is set to Yes. AutoResize automatically adjusts the display of your form to the size you designed it. If this property is set to No, the form appears in the way you last saved it, which can easily be too big or small.

Set Combo Boxes LimitToList to Yes

Combo boxes should have their LimitToList property set to Yes so users can only enter values in the list. If this is set to No, users can enter any value. To support users adding new values to the list, set the LimitToList property to Yes, and use the NotInList event to handle the new values.

Increase Number of Rows Displayed for Combo Boxes

The drop down from a combo box should be greater than the default of 8 (16 for Access 2007), so that if your list is longer, more can be shown without the user being forced to scroll through them. We recommend 25 or more.

Set Combo Box AutoExpand Property to Yes

AutoExpand simplifies data entry by auto-filling the remainder of the selection based on the first few letters the user types.

Set AllowDesignChanges Property to Design View Only

The AllowDesignChanges property should not be All Views, but rather Design View Only. When set to All Views, users can change the design even though they are not in design view. This is something one rarely wants them to do. In fact, if the form property sheet is open the last time a form was designed, when a form appears with this property set to All Views, the property sheet also appears which is very confusing to end-users.

Use System Colors

For the BackColor property of form sections and controls, use the system gray color (-2147483633) rather than the default gray (12632256). In recent versions of Windows (Windows Me, 2000, XP), there's a slight change in the way gray is displayed, and the older gray appears darker than it should. Mixing these two values for older Windows versions is not a problem but you can see a difference on new versions. For Access 2007, see the tips below.


Additional Resources

Making sure forms are properly designed takes time and effort to verify all the things that could go wrong. This is especially difficult if you are taking over someone else’s work and/or if there are a large number of forms. Fortunately, there are some tools which can address some of the pitfalls listed here by examining all your forms and highlighting the problems.

The first is Total Access Analyzer from FMS, Inc. Total Access Analyzer is the most popular Access add-in and offers comprehensive database analysis that covers much more than forms. With the exception of verifying the accuracy of what users see, the form analysis detects all the other pitfalls listed here plus many other areas such as module code analysis, procedure flow diagrams, cross-reference documentation and verification, and much more.

The second tool, Total Access Speller, is also from FMS, Inc. Total Access Speller is a spell-checker that spell checks what the user sees on your forms, reports, and other objects. Easily verify all the captions, validation text, and control tips are properly spelled.

For significantly enhancing the user interface of forms, consider Total Access Components, a collection of 29 ActiveX controls designed specifically for Access to make your forms dazzle. Add animation, rotated text, fancy borders, etc.

Tips for designing forms


Conclusion

Developing an application takes a lot of effort. Don’t let simple mistakes ruin your application and embarrass you in front of your boss and/or clients. Even a simple typo can ruin the trust a user has for your application, work, and attention to detail. It usually only takes a few minutes per form to ensure those who use it don’t see obvious problems. This is a wise investment of your time for your career and reputation. Use this checklist as the basis of your quality assurance process for your forms. If you find other problems, add them to the list so you can avoid them in the future. Making mistakes is okay. Making the same mistake more than once means you’re not learning. Good luck.

Table Design

Query Design

Form Design

Form Tips and Mistakes

Module VBA to Forms and Controls

Form Navigation Caption

Using a RecordsetClone

Synchronize Two Subforms

Multiple OpenArgs Values

Late Bind Tab Subforms

Subform Reference to Control Rather than Field

Tab Page Reference

Shortcut Keys


Combo Box Top Tips

Properties and Validation

Select First Item

Cascading Combo Boxes

Zip, City, State AutoFill

Report Design

Suppressing Page Headers and Footers on the First Page of Your Report

Add the NoData Event

Annual Monthly Crosstab Columns

Design Environment

Adding Buttons to the Quick Access Toolbar

Collapsing the Office Ribbon for more space

VBA Programming

Basics: Forms and Controls

Using Nz() to Handle Nulls

Avoiding Exits in the Body of a Procedure

Shortcut Debugging Keys

Setting Module Options

Math Rounding Issues

Rename a File or Folder

Avoid DoEvents in Loops

Age Calculations

Weekday Math

Sending Emails with DoCmd.SendObject

Source Code Library

Microsoft Access Modules Library

Microsoft Access Modules

VBA Error Handling

Error Handling and Debugging Techniques

Error Number and Description Reference

Basic Error Handling

Pinpointing the Error Line

Performance Tips

Linked Database

Subdatasheet Name

Visual SourceSafe

Deployment

Runtime Downloads

Simulating Runtime

Prevent Close Box

Disable Design Changes

Broken References

Remote Desktop Connection Setup

Terminal Services and RemoteApp Deployment

Reboot Remote Desktop

Missing Package & Deployment Wizard

Avoid Program Files Folder

Microsoft Access Front-End Deployment

System Admin

Disaster Recovery Plan

Compact Database

Compact on Close

Database Corruption

Class Not Registered Run-time Error -2147221164

Inconsistent Compile Error

Decompile Database

Bad DLL Calling Convention

Error 3045: Could Not Use

Converting ACCDB to MDB

SQL Server Upsizing

Microsoft Access to SQL Server Upsizing Center

Microsoft Access to SQL Server Upsizing Center

When and How to Upsize Access to SQL Server

SQL Server Express Versions and Downloads

Cloud and Azure

Cloud Implications

MS Access and SQL Azure

Deploying MS Access Linked to SQL Azure

Visual Studio LightSwitch

LightSwitch Introduction

Comparison Matrix

Additional Resources

Connect with Us

 

Free Product Catalog from FMS