How to Use an Access Combo Box to Disable Controls Conditionally
Question details
The user needs to dynamically disable specific text boxes and show a date field on a form based on the value selected in an Access combo box.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Building a dynamic data entry form where the availability and visibility of certain controls depend on the building type chosen in a combo box.
- Observed behavior
- The controls currently remain static; they need to be programmed to react immediately when the user updates the combo box selection.
Ensure your Microsoft Access database is backed up and that you have identified the exact internal names of your combo box and the form controls you wish to disable or show.
Use the After Update Event in the VBA Editor
Write a VBA script triggered by the combo box's After Update event to toggle the Enabled and Visible properties of your target controls.
The most reliable way to handle conditional formatting and control states in Access forms is through VBA Code Builder. By tying the logic to the 'After Update' event, the form instantly updates as soon as the user changes the combo box selection.
Right-click your form in the navigation pane and select 'Design View'. Click on the combo box you want to use as the trigger.
Press F4 to open the Property Sheet. Go to the 'Event' tab, find the 'On After Update' property, and click the ellipsis (...) button next to it.
In the Choose Builder dialog box, select 'Code Builder' and click OK. This will open the VBA Editor directly to the correct event subroutine.
Inside the subroutine, write an If...Then or Select Case statement. For example: If Me.cboBuildingType.Value = "C" Then Me.txtDate.Visible = True Else Me.txtDate.Visible = False End If. Use Me.ControlName.Enabled = False to disable text boxes as needed.
Save your VBA code and close the editor. Switch your Access form back to 'Form View' and test the combo box to ensure the controls disable or appear correctly.

Looking for a Lightweight, Everyday Office Suite?
While Microsoft Access handles complex database management, WPS Office is the perfect solution for your daily document, spreadsheet, and presentation tasks. It offers a free, lightweight, and highly compatible alternative to Microsoft Office, ensuring a seamless transition with zero learning curve.
- 1. Download WPS Office: Visit the official WPS website and click the Free Download button.
- 2. Install the Suite: Run the lightweight installer to quickly set up WPS Office on your device.
- 3. Start Creating: Open WPS Office to effortlessly manage your documents, spreadsheets, and presentations.

Frequently Asked Questions
Why is my combo box After Update event not firing?
Ensure your form is in Form View, not Layout View. Additionally, check your database Trust Center settings to make sure macros and VBA code are enabled; otherwise, the event scripts will be blocked from running.
Can I hide the ID column in my Access combo box but still use it in VBA?
Yes. You can set the first column width to 0 cm in the combo box's Format properties. The hidden ID will remain the 'Bound Column' used in your VBA logic, while users will only see the descriptive text values.
Should I use Macro Builder or Code Builder for changing control visibility?
While Macro Builder can perform basic actions, Code Builder (VBA) is highly recommended for modifying control properties like 'Enabled' or 'Visible' based on complex conditions, as it offers much more flexibility and easier debugging.
How do I re-enable a disabled control if the user changes the combo box selection again?
In your If...Then or Select Case logic within the After Update event, you must account for all scenarios. Ensure you explicitly set Me.ControlName.Enabled = True in the 'Else' or alternative case blocks to revert the changes.




