Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide and Unhide Form Detail

Status
Not open for further replies.

rocket2000

Technical User
Jan 31, 2011
9
IE
Hi, anyone know how I can hide and unhide the Detail Section with controls on a form.
I would like to use a command button from the form footer section to hide, minimize or shrink this section along with the controls.




Thanks
 
You can hide the detail section with code like:
Code:
Private Sub Command0_Click()
    Me.Section(0).Visible = Not Me.Section(0).Visible
End Sub

This doesn't necessarily shrink the entire form.

Duane
Hook'D on Access
MS Access MVP
 
Hi Duane,

I only realize it's the SubForm in the details section I am looking to hide or shrink
This code below seems to work for a form without a subform but I cannot seem to get it working with a subform in the details section

Dim x As Integer
x = Me.RecordsetClone.RecordCount
Me.InsideHeight = 20 + x * 20


The code you posted only hides the control. Sorry, I probably was not clear but I need to minimize or shrink the forms detail section.

Thanks again for the assistance,

 
What does the recordCount have to do with your question? Are you attempting to resize the subform or make it invisible and take up no space? Are there any controls on the main form under the subform that would need to move up?

If all you want to do is hide the subform, I would set the subform control's Source Object to nothing or just make the subform very small.

Duane
Hook'D on Access
MS Access MVP
 
I have it sorted it now, had the code behind the command button on the subform instead of the main form.


Dim x As Integer
x = Me.RecordsetClone.RecordCount
Me.InsideHeight = 20 + x * 20

It's working now.
Thanks for your help.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top