O'Reilly logo

Access™ 2007 VBA Programmer's Reference by Armen Stein, Geoffrey Griffith, Rob Cooper, Teresa Hennig

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

M.5. Display Informative Form Captions

If you don't set your own form captions, Access just displays the form name there, as shown in Figure M-6.

Figure M.6. Figure m-6

This is a sure sign of a novice developer. You need to, at least, replace the caption with the name of your application. One nice additional touch for the caption is to indicate which back-end database you are currently using. That way, your users know instantly whether they're in the Production or Test database, for example.

You'll need a table in the back-end database to store systemwide configuration values. In this example, it is named tsysConfig_System, and it has a field containing the name of the database (see Figure M-7).

Figure M.7. Figure m-7

You also need a local table in the front-end to store static values for the application itself, as shown in Figure M-8. In the example, one of the fields is the name (title) of the application, suitable for showing on various forms throughout the system.

Figure M.8. Figure m-8

The code to set the caption is easy. It belongs in the Open event code behind every form:

Me.Caption = DLookup("ApplicationTitle", "tsysConfig_Local") _ &" - "& DLookup("SysConfigDatabaseName", ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required