Change multiple form titles

  • Thread starter Thread starter NHMM
  • Start date Start date
N

NHMM

I am looking for suggestions on how to easily modify the title (label) of
multiple forms in a database. I have a database that is cloned for each
project (i.e. each project has its own separate database). I would like the
project number to be at the top of each form as part of a label
(concocanated). Any suggestions on how to set it up so that the project
number could be entered in only one place and all the forms would be updated?
Also note, the project number needs to be stored in the database to prevent
entering it every time the database is opened - I only need an easy way to
modify or overwrite it.
Any thoughts are appreciated - Thanks
NHMM
 
I often have a Table in the database, typically called "SysInfo" just for
such "customizing values". The application reads the first (and usually
only) record on startup and sets values into variables in a standard module
so they are "global" or accessible from any VBA code in the application.
The advantage over defining Constants in a standard module is that you may
want to save some of these at runtime, and have the saved value instead of
the original at next startup.

For what you describe, as ruralguy suggested, you could use a Constant in a
standard module (that's the module you get when you open a new Module in the
Modules tab of the Database Window in Access 2003 or earlier) and you'd
probably define something like:

Const ProjName As String = "The Wentworth Project"

If you are using Access 2007, then someone else will need to tell you how to
navigate to the module window.

Larry Linson
Microsoft Office Access MVP
 
I am looking for suggestions on how to easily modify the title (label) of
multiple forms in a database. I have a database that is cloned for each
project (i.e. each project has its own separate database). I would like the
project number to be at the top of each form as part of a label
(concocanated). Any suggestions on how to set it up so that the project
number could be entered in only one place and all the forms would be updated?
Also note, the project number needs to be stored in the database to prevent
entering it every time the database is opened - I only need an easy way to
modify or overwrite it.
Any thoughts are appreciated - Thanks
NHMM

I'll have to disagree with Ruralguy here - global variables vanish under some
circumstances (breaks or errors in code, for example).

Instead, create a little hidden one-row, one-field table with the project
number. Put a *textbox* (not a label) on each subform, with a control source

=DLookUp("[ProjectNo]", "[ProjectNoTable]")

Have a (administrators only) update form to update the table.
 
Do Global Constants vanish as well?

They do not, because they are hardwired in the compiled code.

I would still use something other than a global constant for this
kind of data, since I don't like building apps with constants in
them that are specific to a particular project, since I may end up
using components in another app. I am much more likely to use a data
table to store the data, and self-healing functions (using Static
variables internally to minimize trips back to the data table) to
retrieve the data.
 
Back
Top