Access™ 2007 VBA Programmer's Reference
by Teresa Hennig, Rob Cooper, Geoffrey Griffith, Armen Stein
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", ...Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access