Others

How to Automatically Populate Form Fields Based on a Selection in Microsoft Access

Phi Hung VoPhi Hung Vo Oct 26, 2026 868 views

Question details

The user needs a method to automatically fill dependent data-entry form fields based on a specific selection from a primary drop-down list or combo box.

Automatically Populate Microsoft Access Form Fields Based on a Selection
Product
Microsoft Access
Device & OS
not provided
Scenario
Designing a data-entry form for medical outcome data where selecting a value like 'None' for the highest level of care should automatically set subsequent fields to 'No' or 0 to speed up data entry.
Observed behavior
The user currently has to manually enter data into dependent fields, and needs a way to automate this population based on the initial combo box selection.
Before you start

Before adding automation code, ensure your database table fields have concise names without spaces or special characters (like <, >, or parentheses), as these complicate VBA programming.

Solution 1Recommended

Use the After Update Event with VBA Code

Attach a VBA procedure to the initial combo box's After Update event to detect the user's selection and instantly assign appropriate values to the dependent form controls.

In Microsoft Access, the After Update event is triggered immediately after a user makes a selection and moves out of a control. By attaching VBA code to this event, you can command Access to automatically fill in remaining fields. Note that storing calculated or heavily dependent values in a database table can sometimes conflict with relational database design principles; ensure that permanently storing these derived values is necessary for your workflow.

1
Open Form in Design View

Right-click your data-entry form in the Access navigation pane and select 'Design View'.

2
Select the Primary Control

Click on the initial combo box or drop-down list (e.g., 'Highest Level of Neonatal Care') that will trigger the changes.

3
Access the Event Property

Press F4 to open the Property Sheet. Go to the 'Event' tab and locate the 'After Update' property.

4
Open the VBA Code Builder

Click the ellipsis (...) button next to 'After Update' and select 'Code Builder' from the dialog box to open the VBA editor.

5
Enter the Automation Code

Write the VBA IF statement to evaluate the selection and set dependent fields. For example: `If Me.LevelOfCare = "None" Then Me.AdmittedWithin48 = False : Me.TimeInNICU = 0 End If`.

6
Save and Test

Save your VBA code, close the editor, switch your form back to 'Form View', and test the combo box to ensure the dependent fields update automatically.

Use the After Update Event with VBA Code
Field Naming Best Practices: Rename cumbersome fields (e.g., 'time in NICU, HDU, or SCBU (<50 chars)') to simple, descriptive names like 'TimeNICU'. This prevents syntax errors and eliminates the need for brackets in your VBA code.
Free Microsoft Office alternative

Looking for a Lightweight Tool for Data Collection? Try WPS Office

While Microsoft Access is built for complex relational databases, many data tracking and collection tasks can be accomplished more easily with a robust spreadsheet application. WPS Office offers a free, highly compatible alternative to Microsoft Office, featuring powerful formulas and data validation tools to handle your everyday data entry needs without writing complex VBA code.

  1. 1. Download and Install: Download WPS Office Free from the official website and follow the quick installation process.
  2. 2. Open WPS Spreadsheet: Launch the application and create a new Spreadsheet, or open your existing .xlsx data tracking files.
  3. 3. Automate Data Entry: Use features like Data Validation for drop-down lists and IF formulas to automatically populate dependent cells instantly.
Fully compatible with Microsoft Excel (.xlsx), Word (.docx), and PowerPoint (.pptx) formatsEasily create dependent drop-down lists and auto-filling cells using WPS Spreadsheet formulasFree, lightweight, and uses minimal system resourcesFamiliar interface makes transitioning from Microsoft Office seamless
microsoft office alternative - wps office

Frequently Asked Questions

What is the After Update event in Microsoft Access?

The After Update event is a control property that triggers a macro or VBA procedure exactly when the data inside a specific control (like a text box or combo box) is changed and the user moves to another field.

Why should I avoid spaces and special characters in database field names?

Spaces and special characters complicate programming and queries. In VBA or SQL, you must constantly wrap field names containing spaces or symbols in square brackets (e.g., [Field Name]). Using concise CamelCase naming (e.g., FieldName) prevents errors.

Is it bad practice to store dependent values in an Access table?

Often, yes. In relational database normalization, storing values that can be fully deduced or calculated from another field can lead to redundant data and anomalies. It is usually recommended to calculate these dependent values on-the-fly using queries or forms instead of storing them directly.