How to change the form title or caption from VBA.

PuddinPie

Registered User.
Local time
Today, 05:31
Joined
Sep 15, 2010
Messages
149
Hello,

I'm trying to create a module that when a form opens it will look at the module and set the forms title as per what it says in the module.
I've been looking arround but can't seem to find a specific way of doing it.

Does anyone know how this would be done?

Thank you.
 
You'd set the Access.Form.Caption property.
If you have a public property in a module, something like ...
Code:
Public Property Get HelloWorld as String
  HelloWorld = "Hello World!"
End Property
...then, in the open event handler of a form you could do...
Code:
Private Sub Form_Open(Cancel as Integer)
  Me.Caption = HelloWorld
End Sub
Does that help?
 

Users who are viewing this thread

Back
Top Bottom