logo
search
Others

How to Add Products to an Access Order Form Using a Combo Box

Kushani NimanthikaKushani Nimanthika Oct 8, 2026 869 views

Question details

The user needs a method to add products to an order-details subform in Microsoft Access, specifically utilizing an unbound combo box and an Add button.

How to Add Products to an Access Order Form Using a Combo Box
Product
Microsoft Access
Device & OS
not provided
Scenario
Designing an order entry database form and looking for an efficient way to append selected products from a drop-down list into the order details records.
Observed behavior
The user wants to understand the VBA code and configuration required for the Add button to successfully copy a product into the underlying subform.
Before you start

Ensure your database tables (e.g., Orders, Products, and OrderDetails) are properly linked with primary and foreign keys. Back up your Access database before modifying form designs or implementing new VBA code.

Solution 1Recommended

Use an Unbound Combo Box and Add Button with VBA

Implement an unbound combo box paired with a VBA SQL INSERT statement to smoothly add a chosen product to your order-details subform.

This approach gives you precise control over the order entry process. By using an unbound combo box, users can search for a product without immediately modifying a record. The Add button (or the combo box's AfterUpdate event) then executes a SQL command to append the item directly into the underlying OrderDetails table.

1
Add an Unbound Combo Box

Open your main order form in Design View. Select the Combo Box control from the Form Design tools and place it on your form. Cancel the wizard to leave it unbound, and set its Row Source property to your Products table.

2
Create the Add Button

Insert a Command Button next to your new combo box and name it 'Add Product'. This button will trigger the record appending process.

3
Write the VBA INSERT Code

Right-click the 'Add Product' button, go to Properties, click the Event tab, and choose [Event Procedure] for the On Click event. In the VBA editor, write an `INSERT INTO` statement: `CurrentDb.Execute "INSERT INTO OrderDetails (OrderID, ProductID, Quantity) VALUES (" & Me.OrderID & ", " & Me.cboProduct & ", 1)"`.

4
Requery the Subform

Immediately after the `CurrentDb.Execute` line, add `Me.YourSubformName.Requery` to refresh the subform data so the newly added product appears instantly.

Use an Unbound Combo Box and Add Button with VBA
Tip: Always set a valid default quantity (such as 1) in your VBA code or table design to prevent null validation errors when the new record is inserted.
Free Microsoft Office alternative

Need a Lightweight Alternative for Word, Excel, and PowerPoint?

While Microsoft Access handles complex database logic, much of your daily reporting, data tracking, and documentation can be managed seamlessly with a free office suite. WPS Office provides an all-in-one solution for documents, spreadsheets, and presentations with high compatibility and zero cost.

  1. 1. Download WPS Office: Visit the official WPS Office website and download the free installer for your operating system.
  2. 2. Import Database Reports: Export your Access order reports as CSV or Excel files, and open them in WPS Spreadsheet.
  3. 3. Analyze Your Data: Use built-in data validation (drop-down lists) and PivotTables in WPS Spreadsheet to manage and analyze your order entries effectively.
Fully compatible with Microsoft Excel (.xlsx), Word (.docx), and PowerPoint (.pptx) formats.Lightweight application that runs smoothly across Windows, Mac, and Linux environments.Familiar, easy-to-use tabbed interface for seamless migration without a steep learning curve.Robust Spreadsheet features including PivotTables and Data Validation for managing exported database reports.
microsoft office alternative - wps office

Frequently Asked Questions

Why isn't my subform updating after I click the Add button?

The subform must be refreshed to display new records added via background VBA. Ensure you have included the code `Me.YourSubformControlName.Requery` at the end of your Add button's On Click event procedure.

How do I set a default quantity when adding a product from a combo box?

You can define the default quantity directly in your VBA `INSERT INTO` statement. For example, specify `1` in the values clause: `VALUES (Me.OrderID, Me.cboProduct, 1)`.

Should I use an Add button or the combo box's AfterUpdate event?

An Add button is generally better if users need to review their selection or manually type a custom quantity before committing the record. The combo box's AfterUpdate event is faster for single-click, identical-quantity additions.

Can I review how this works in a standard Microsoft sample?

Yes, you can review the Northwind sample database provided by Microsoft. It contains standard implementations of order-entry systems and demonstrates how to effectively link main forms and subforms with combo boxes.