How to Show an Access Subform When a Checkbox is Selected
Question details
The user needs to display an Access subform conditionally when a specific checkbox is selected, and maintain correct visibility when navigating through existing records.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Designing a Microsoft Access database form where a subform's visibility is controlled by user interaction with a checkbox control.
- Observed behavior
- The user wants the subform to appear immediately when the checkbox is ticked and to display correctly based on saved checkbox values when scrolling through previous records.
Ensure you have your Microsoft Access database open in Design View, and note the exact names of both your checkbox control and the subform control on your main form.
Use VBA in After Update and On Current Events
This method uses a straightforward VBA script to link the subform's Visible property directly to the checkbox's value, ensuring real-time updates and accurate historical record display.
To make the subform toggle dynamically, you must attach the VBA code to two different form events. The 'After Update' event triggers when the user clicks the checkbox, while the 'On Current' event ensures the subform's visibility updates correctly as you scroll through previously saved records.
Open your main form in Design View. Select the subform control, open the Property Sheet (press F4), go to the Format tab, and set the 'Visible' property to 'No'.
Select the checkbox control. In the Property Sheet, navigate to the Event tab. Click the ellipsis (...) next to the 'After Update' property, choose 'Code Builder', and enter the following code: Me.[YourSubformName].Visible = Me.[YourCheckboxName] (replace bracketed text with your actual control names).
Click the selector box in the top-left corner of the main form to select the form itself. In the Property Sheet's Event tab, click the ellipsis (...) next to 'On Current', choose 'Code Builder', and paste the exact same VBA code used in the previous step.

Looking for a Free Office Suite? Try WPS Office
While Microsoft Access requires a paid Microsoft 365 subscription, you can handle your everyday document, spreadsheet, and presentation tasks completely free with WPS Office. It provides a highly compatible and familiar workspace for all your essential office needs.
- 1. Download WPS Office: Visit the official WPS Office website and click the free download button.
- 2. Install the Software: Run the downloaded installer and follow the simple on-screen instructions.
- 3. Open Your Files: Launch WPS Office and easily open, edit, and save your existing .docx, .xlsx, and .pptx files.

Frequently Asked Questions
Why am I getting an error when typing the VBA code directly into the Property Sheet?
You cannot type raw VBA code directly into the Event property line in Access. You must click the ellipsis (...) next to the event, choose 'Code Builder', and enter your VBA code in the Microsoft Visual Basic for Applications editor window.
Why does the subform stay visible when I move to a new record?
This happens if you only placed the code in the 'After Update' event of the checkbox. To fix this, you must also add the exact same visibility code to the main form's 'On Current' event so it evaluates the checkbox state every time you navigate to a different record.
Can I use an Access Macro instead of VBA to show the subform?
Yes. You can use the Macro Builder instead of Code Builder. Create an 'If' block checking if the checkbox value is True, and use the 'SetProperty' macro action to change the subform's Visible property to True. Add an 'Else' block to set it to False.




