Others

How to Change an Access Subform Source Object Using a Macro

Maira MehtabMaira Mehtab Oct 29, 2026 869 views

Question details

The user wants to dynamically change the source object of a subform in Microsoft Access based on a combo box selection.

How to Change an Access Subform Source Object Using a Macro
Product
Microsoft Access
Device & OS
not provided
Scenario
Building a dynamic form where the displayed subform changes according to user input from a drop-down list.
Observed behavior
Needs to execute a statement in the combo box's After Update event to swap the active subform source.
Before you start

Ensure that the subforms you intend to use as source objects already exist in your Access database, and take note of the exact names of your combo box and subform controls.

Solution 1Recommended

Use VBA in the Combo Box After Update Event

The most efficient way to change the subform source object is by assigning the combo box value to the subform's SourceObject property using VBA.

By utilizing the After Update event of a combo box, Microsoft Access can instantly evaluate the user's selection and trigger a VBA statement. This allows your main form to remain static while the embedded subform container switches between different forms or views.

1
Open Form in Design View

Right-click your main form in the Navigation Pane and select 'Design View'.

2
Access Combo Box Properties

Select the combo box (e.g., 'OrderType'), open the Property Sheet by pressing F4, and navigate to the 'Event' tab.

3
Add After Update Code

Click the ellipsis (...) next to the 'After Update' property, choose 'Code Builder', and enter the following one-line statement: Me.Orders.Form.SourceObject = Me.OrderType

4
Adapt Control Names

Make sure to replace 'Orders' with your actual subform control name and 'OrderType' with the actual combo box name matching your database design.

Use VBA in the Combo Box After Update Event
Important Note on Syntax: If you are assigning a specific form name rather than passing the combo box value directly, ensure the form name is enclosed in quotation marks (e.g., Me.Orders.SourceObject = "Form.YourFormName").
Free Microsoft Office alternative

Looking for a Free, Lightweight Microsoft Office Alternative?

While Microsoft Access handles complex relational databases, most everyday data tracking, reporting, and documentation can be managed seamlessly with WPS Office. WPS Office is a powerful, free alternative to Microsoft Office that includes Writer, Spreadsheet, and Presentation.

  1. 1. Download WPS Office: Visit the official WPS website and click the free download button.
  2. 2. Install the Suite: Run the downloaded installer and follow the quick setup wizard.
  3. 3. Start Managing Data: Open WPS Spreadsheet to seamlessly organize, track, and analyze your tabular data as a lightweight alternative to complex databases.
Highly compatible with Microsoft Excel (.xlsx), Word (.docx), and PowerPoint (.pptx) formats.Powerful Spreadsheet application with advanced formulas and pivot tables for robust tabular data management.Lightweight installation with an intuitive, familiar tabbed interface.Built-in PDF editing capabilities at no extra cost.
microsoft office alternative - wps office

Frequently Asked Questions

Why am I getting a 'Control can't be found' error in Access?

This error usually occurs when the names used in your VBA code (like 'Orders' or 'OrderType') do not match the exact control names on your form. Double-check the 'Name' property in the Property Sheet for both the combo box and the subform container.

Can I change the subform source object using an Access Macro instead of VBA?

Yes, you can use the 'SetValue' macro action in a standalone Access Macro. Set the Item argument to [Forms]![MainFormName]![SubformControlName].[SourceObject] and the Expression to the name of the new form enclosed in quotes.

Does changing the subform source object affect the underlying tables?

No, dynamically changing a subform's source object only alters which form or query is displayed in the user interface. It does not delete or modify the structure of your underlying database tables.