Discussion Locked

Constants for Titles

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I made a Constant in the General Module. (Const title = "My Title")

Then I want this title to appear on every form & report as the title box at the top. When the title needs changes, I just have to change it in ONE PLACE.

OK, how do I do it??????

5 replies

by mslizny

Perhaps you could hint at the program with which you are working? Is this Access?

by sl-campbell

As you stated, you need to put the constant in a module:
Public Constant FORM_TITLE As String = "My Title"

Then, on the Form Load event, place the line:
Me.Caption = FORM_TITLE
or,
Label1.Caption = FORM_TITLE

To change the title for all forms with the caption set to FORM_TITLE, you only need to change the string assigned to the Public Constant 'FORM_TITLE':

FORM_TITLE = "My New Title"

If you want to change the global title name at run time, then do not use a constant, but instead use a public/global variable. Then you can change the string assigned to the variable from anywhere in the program in design mode or at run time.

by mra2

Fantastic Answer!!!!! Already changed two databases and used
Report.Caption = Wintitle
Form.Caption = Wintitle

for the Windows Title

Thanks!!!!

This discussion is closed to new replies.