How to hide or show a Microsoft Access subform

Some applications require controls to be shown at certain times. Also we may wish to save space on our screen by hiding controls.

I will show you how to hide a Microsoft Access subform.

Add a check box to the form.

I have set the caption of the label to ‘Hide’.

Right click the check box and select properties.

 

I have named the check box as ‘chkHide’.

 

I select the event properties, specifically the ‘On Click’ event.

 

Click the small button next to the event procedure to open the code window.

The code here is quite simple.

Private Sub chkHide_Click()

If chkHide.Value = True Then

frmInvoiceSub.Visible = False

Else

frmInvoiceSub.Visible = True

End If

End Sub

It says if there is a tick in the check box (chkHide.Value = True) then hide it otherwise if there is no tick then show it.

Save the code and close the code window.

Now run the form.

before tick…

 

The less clutter on our screens the better.

We need to have a clear workspace and only use what we need.

Microsoft Access offers us an easy way to hide or show controls.

Tags: ,