S
Squibbly2
is it possible to set a control as a variable e.g.
example=Me!controlName.Visible
if so is that a correct example?
example=Me!controlName.Visible
if so is that a correct example?
Marshall Barton said:Yes, the Set is necessary when assigning an object (as
opposed to a value) to a variable.
But, in addition, you should be concerned with how the
object variable is declared. You can Dim the object
variable as a Variant, but that is the most inefficient way
and does not provide any meaningful error checking. [Note
that you should **always** declare your variables and to
enforce that rule, make sure you have an OPTION EXPLICIT
statement in **all** your modules.]
When you do not know what kind of control you will be
assigning to the variable, you should use:
Dim xxx As Control
but, when you do know the control type, then use the
specific type, e.g.
Dim xxx As TextBox
--
Marsh
MVP [MS Access]
dont worry i found out how to do it
Set xxx=Me!ControlName
xxx.Visible=True