Hide a subform in MS access

Asked By 20 points N/A Posted on -
qa-featured

How to hide or active subforms? Is the below coding correct?

SHARE
Best Answer by Sharath Reddy
Answered By 0 points N/A #91733

Hide a subform in MS access

qa-featured

Hello,
I have understood your problem and I have a solution for you. This will resolve the problem completely. I have attached a solution with help of link. You have to visit this link you will follow towards the answer. Here is the link:

http://access-databases.com/how-to-hide-or-show-a-microsoft-access-subform/

In this link a detail of the option with pictures and the detailed information has been given about the problem you are facing. I am sure you have got the points.

Here as far as hide the subform and many more features detail is given. Hope so you got the point. 

Best of luck for your future.

Thanks.

Best Answer
Best Answer
Answered By 562865 points N/A #91735

Hide a subform in MS access

qa-featured

There are different ways of hiding or displaying a sub form in Microsoft Office Access. You can use an event of the form, a form control, using a command button, or using a toggle button. In many cases, your computer monitor's screen estate may be at a real premium, with many elements and form controls vying for position.

To enable you to show or hide the sub form, you need to apply some code to the On Current event of the main form. This will show or hide the sub form if the Active Member checkbox is checked as you scroll through the main form. You will also need to add code to the After Update event of the Active Member checkbox, as this will then show or hide the sub form depending on the selection made in the checkbox.

The code used in the On Current event of the main form is:

Private Sub Form_Current()
'On current event of main form
'Check if Active checkbox is selected
'then show or hide subform
    If Me.Active = True Then
        Me.sfrmPaymentsSubform.Visible = True
    Else
        Me.sfrmPaymentsSubform.Visible = False
    End If
End Sub

The code used in the After Update event of the checkbox [Active] in the main form is:

Private Sub Active_AfterUpdate()
'After Update of checkbox
'Check if Active checkbox is selected
'then show or hide subform
    If Me.Active = True Then
        Me.sfrmPaymentsSubform.Visible = True
    Else
        Me.sfrmPaymentsSubform.Visible = False
    End If
End Sub

If you uncheck the Active Member checkbox, the After Update event of the checkbox is fired and the sub form's visible property is set to False, and the sub form is hidden from display. If you require additional information, please visit Showing or Hiding Microsoft Access Subforms.

Login/Register to Answer

Related Questions