VBA to hide a lable ?

  • Thread starter Thread starter Martin \(Martin Lee\)
  • Start date Start date
M

Martin \(Martin Lee\)

For example, I want to hide [label2], how is the VBA should be ?

Thank you !
 
For example, I want to hide [label2],
how is the VBA should be ?

Where will this VBA code reside?

In the module (class module) associated with a Form or Report, with a Label
Control named "label2", in the appropriate event,

Me.label2.visible = False

will make that control invisible. Because the Controls are not properly
initialized at the time of the Open Event, don't expect it to work there.

If the code is to run in a Standard Module, you'll need to pass an object
variable for the Form, Report, or Control, or refer to the Form or Report
via the Forms or Reports Collection... as in the following sample

Forms!frmEmployeeUpdate!txtAddressLine1

References can be even more complex if the code is running in a main Form
and the Control resides in a Form embedded in a Subform Control.

Larry Linson
Microsoft Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top