logo
search
VBA & Macro Problems

How to Use an Access Combo Box to Disable Controls Conditionally

Guest WriterGuest Writer Oct 1, 2026 869 views

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.

How to Conditionally Disable Controls Using 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.
Before you start

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.

Solution 1Recommended

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.

1
Open the form in Design View

Right-click your form in the navigation pane and select 'Design View'. Click on the combo box you want to use as the trigger.

2
Access the After Update event

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.

3
Open the Code Builder

In the Choose Builder dialog box, select 'Code Builder' and click OK. This will open the VBA Editor directly to the correct event subroutine.

4
Write the conditional logic

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.

5
Test the form

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.

Use the After Update Event in the VBA Editor
Using Internal Values: Make sure you use the internal bound value (like BuildingID) for your logic instead of the display name. If you want to hide the ID from users, set the first column width of the combo box to 0 cm in the Property Sheet.
Free Microsoft Office alternative

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. 1. Download WPS Office: Visit the official WPS website and click the Free Download button.
  2. 2. Install the Suite: Run the lightweight installer to quickly set up WPS Office on your device.
  3. 3. Start Creating: Open WPS Office to effortlessly manage your documents, spreadsheets, and presentations.
Fully compatible with Microsoft Word, Excel, and PowerPoint formatsLightweight installation that runs smoothly on almost any deviceFamiliar user interface for seamless and rapid migrationBuilt-in PDF editor and advanced productivity tools for free
microsoft office alternative - wps office

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.