Others

Switch Microsoft Access Subforms Based on a Combo Box Selection

Olivia MillerOlivia Miller Nov 22, 2026 868 views

Question details

Display a different subform in Microsoft Access when a user selects a test from a combo box.

Switch Microsoft Access Subforms Based on a Combo Box Selection
Product
Microsoft Access
Device & OS
not provided
Scenario
A parent form contains a test selection combo box and should show the form associated with the selected test.
Observed behavior
The desired result is for the embedded subform to switch to the appropriate test-specific form whenever the combo box value changes.
Before you start

Create the test-specific forms and add a subform control and a test-selection combo box to the parent form. Note the control names, form object names, and the combo box's bound values; unique test IDs are preferable to test names.

Solution 1Recommended

Change the subform SourceObject in the combo box After Update event

Use this approach to load a different form into the same subform control for each test selection.

The SourceObject property determines which form an embedded subform control displays. The example uses numeric test IDs 1 and 2; replace them with your actual bound values and form names.

1
Open the parent form

In the Access Navigation Pane, right-click the parent form and select Design View. Select the subform control and check its Name on the Property Sheet; this example uses sfrmTests.

2
Create the event procedure

Select the test combo box, open its Property Sheet, and choose the Event tab. Set After Update to [Event Procedure], then click the ellipsis button to open the VBA editor.

3
Add the switching code

Inside the combo box's After Update procedure, add the following code, replacing the example control names, IDs, and form names with your own: Select Case Me.cboTestName.Value Case 1 Me.sfrmTests.SourceObject = "Form.frmUrea" Case 2 Me.sfrmTests.SourceObject = "Form.frmOtherTest" Case Else Me.sfrmTests.SourceObject = "" End Select

4
Test the selection

Save the form, switch to Form View, and select each test in the combo box. Confirm that the matching form appears and that an unmatched or empty selection clears the subform.

Change the subform SourceObject in the combo box After Update event
Show the correct form for existing records: If the combo box is bound to a field, its After Update event does not run just because you navigate to an existing record. To update the subform during navigation, add a Form Current event procedure that calls your combo box's After Update procedure, for example: Call cboTestName_AfterUpdate.
Free Microsoft Office alternative

Work with exported test data in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with Office documents. Export Access data to Excel to bring it into WPS Spreadsheets; Access forms, VBA events, and subforms do not migrate automatically and must be rebuilt using a suitable tool.

Review and organize exported test data in spreadsheetsOpen and edit Microsoft Excel XLSX and XLS filesUse a familiar spreadsheet interface for an easier transitionGet a free, lightweight Office alternative
microsoft office alternative - wps office

Frequently Asked Questions

Why does changing SourceObject switch the subform?

A subform control displays the form named in its SourceObject property. Assigning another form, such as "Form.frmUrea", replaces the form displayed in that control.

Should the combo box use a test name or a test ID?

A unique test ID is generally more reliable because names can change or be duplicated. Set the combo box's Bound Column to the column containing the ID, and use those IDs in the Select Case statements.

Why does the subform not update when I move to another record?

The combo box's After Update event runs when its value is edited, not when you navigate between records. Use the parent form's Current event to call the same switching procedure.

How do I keep the subform related to the current parent record?

Select the subform control in Design View and check its Link Master Fields and Link Child Fields properties on the Property Sheet. The linked fields must be appropriate for each form loaded into the control.

What happens if no test matches a Case statement?

In the example, Case Else sets SourceObject to an empty string, clearing the subform control. Add more Case statements for additional test IDs and their corresponding forms.