Share via

Hide Subform with command button

Anonymous
2014-06-20T22:30:47+00:00

Access 2010, Win 8

I have a form "ResourceForm" that has a command button "More Details" to make a subform visible. Once the subform, "ResourceCSubform" is visible, it has a command button "Close" to make it un-visible.

I have tried:

Me.Visible=False

and

DoCmd.Close, "ResourceCSubform"

in the OnClick of the "Close" command button but it does NOT work.

Can you offer some code or method that will hide the subform with a button click??

Thanks,

Max

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2014-06-20T22:59:57+00:00

You first have to move focus from the subform by setting it to any control in the parent form.  You can then hide the subform control:

    Me.Parent.cboOffice.SetFocus

    Me.Parent.ResourceCSubform.Visible = False

where cboOffice is the combo box in your parent form, and ResourceCSubform is the name of the subform control, i.e. the control which houses the subform.  This might or might not be the same as the name of its source form object.

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful