General discussion

Locked

Constants for Titles

By MRA2 ·
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??????

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Constants for Titles

by mslizny In reply to Constants for Titles

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

Collapse -

Constants for Titles

by MRA2 In reply to Constants for Titles

Access 97 See Answer # 2

Collapse -

Constants for Titles

by sl-campbell In reply to Constants for Titles

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.

Collapse -

Constants for Titles

by MRA2 In reply to Constants for Titles

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

for the Windows Title

Thanks!!!!

Collapse -

Constants for Titles

by MRA2 In reply to Constants for Titles

This question was closed by the author

Back to Web Development Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums