How do you set a form varaible from Modual

  • Thread starter Thread starter Richard Albrecht
  • Start date Start date
R

Richard Albrecht

Hi,

I want to set a Labels Caption property from a modual. In Delphi I would
do something like this:

Form1.LabelName.Cation = "This is a test"

However I can't seem to figure out how to do this in VBA.

Help!

Thanks

Rich
 
Richard Albrecht said:
Hi,

I want to set a Labels Caption property from a modual. In Delphi I
would do something like this:

Form1.LabelName.Cation = "This is a test"

However I can't seem to figure out how to do this in VBA.

Help!

Thanks

Rich

I assume the module in question is not the form's own class module. So,
assuming Form1 is currently open, you'd write this:

Forms!Form1!LabelName.Caption = "This is a test"
 
What if you want to set it before you display it? ie the form is not open
yet.

Thanks

Rich
 
Hal said:
Try

Forms("FormName").LabelName.Value = "This is a test"

Sorry, that won't work -- the control reference will work but the
property is wrong. The Value property isn't the same as the Caption
property, and a label control doesn't have a Value property.
 
Back
Top