How to Automatically Populate a Field on a Microsoft Access Form
Question details
The user needs to automatically fill a specific field on an Access form when selecting a value from a combo box lookup.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Entering data into a Microsoft Access form and wanting secondary fields to auto-fill based on a primary combo box selection.
- Observed behavior
- The target field should automatically populate with a corresponding value from a related lookup table upon selection.
Ensure you have a main table for your form and a secondary lookup table containing the reference values you want to fetch.
Use Combo Box Row Source and the After Update Event
Configure your combo box to fetch related columns from the lookup table and use a simple VBA macro in the After Update event to copy the value to the target field.
By modifying the SQL query in the Row Source property of your combo box, you can bring in multiple columns of data from your lookup table. You can then use the After Update event to extract a specific column's value and assign it to another text box on your form.
Open your form in Design View, select the combo box, and open the Property Sheet. Under the Data tab, set the Row Source to a SELECT query that includes your target field, for example: SELECT ProtoCategoryID, ProtoCategory, CategoryTime FROM tblProtoCategory;
In the Format tab of the Property Sheet, change the Column Count to match the number of fields in your query (e.g., 3). If you want to hide the extra columns from the user's view, set the Column Widths property appropriately (e.g., 0cm;3cm;0cm).
Go to the Event tab on the Property Sheet for the combo box. Click the ellipsis (...) next to On After Update and choose Code Builder. In the VBA editor, enter the following code: Me.CategoryTime = Me.cboProtoCategory.Column(2).
Save your VBA code and form design. Switch to Form View, select a category from your combo box, and verify that the Category Time field automatically populates with the correct value.

Looking for a Free Office Suite? Try WPS Office
While WPS Office does not include a direct database alternative to Microsoft Access, it offers a robust, free, and lightweight suite for all your document, spreadsheet, and presentation needs. It is an excellent daily driver for your office tasks.
- 1. Download the Installer: Visit the official WPS Office website and download the free installer for your operating system.
- 2. Install WPS Office: Run the setup file and follow the on-screen instructions to install the suite.
- 3. Open Your Office Files: Launch WPS Office and directly open your existing Word, Excel, or PowerPoint files without losing formatting.

Frequently Asked Questions
Why is my populated field showing the wrong value?
Double-check your column index in the VBA code. Access combo boxes use zero-based indexing, so if you are trying to pull the second column from your query, you must use Column(1), not Column(2).
Do I need to store the fetched value in the main table?
If the value (like Category Time) is fixed and just for display, you can simply bind the text box directly to the combo box column without saving it. However, if the data needs to be recorded historically for that specific record even if the lookup table changes later, it is best to copy and bind it to the main table as demonstrated.
How do I hide the extra columns in the Access combo box dropdown?
In the Property Sheet for the combo box, navigate to the Format tab and set the Column Widths property. Use 0cm or 0" for the columns you want to hide (for example, setting it to 0cm;3cm;0cm hides the first and third columns).




