Refer to control on subform

D

DJW

I have a main form named "Cases" and subform named "Time_Spent" . This
subform has a rectangle box/object I placed on it named "Box1" using the
toolbox. I would like to click on a button I placed on the main form and
make this object invisible but I do not know the proper reference to the
object using visual basic code. I tried using the line below but it does
not work

Me.subfrm_Time_Spent.[Box1].Visible = False

Secondly, how do I do the reversal... such as refer to "Box2" on the main
form by clicking on a button on the subform?
 
M

Marshall Barton

DJW said:
I have a main form named "Cases" and subform named "Time_Spent" . This
subform has a rectangle box/object I placed on it named "Box1" using the
toolbox. I would like to click on a button I placed on the main form and
make this object invisible but I do not know the proper reference to the
object using visual basic code. I tried using the line below but it does
not work

Me.subfrm_Time_Spent.[Box1].Visible = False

Secondly, how do I do the reversal... such as refer to "Box2" on the main
form by clicking on a button on the subform?


Assuming you have all the names correct (and don't forget
that you must use the name of the subform **control**)

Code in the main form to manipulate a control in a subform:
Me.subfrm_Time_Spent.FORM.[Box1].Visible = False

Code in a subform to manipulate a control on the main form:

Parent.Box2.Visible = False
 

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

Top