Controlling Sub Form Properties

D

David Wetmore

I have a form/subform relationship, frmSearchBooks/sfrmSearchResults. I would like to control the visibility of the
subform from within its parent

When I activate the parent form the statement "Forms.frmSearchBooks.sfrmSearchResults.Visible = False" gives me runtime
error 2465.

How do I control the visibility of a subform from within its parent?

Thanks, Dave
 
J

Jeanette Cunningham

Hi David,
there is a specific syntax to use to refer to the subform from its main or
parent form.
Me.NameOfSubformControl

The actual subform is inside a subform control.
Click once on the subform, see that the handles around the edge of the
subform control are visible - you have clicked on the subform control. Click
again on the subform and you are in the subform instead of the subform
control.

Your code needs to be-->
Me.NameOfSubformControl.Visible = False

Note: replace NameOfSubformControl with the real name of your subform
control.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

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