logo
search
Others

How to Pass a Value from a Nested Access Subform to a Popup Form

WPS Content ManagerWPS Content Manager Oct 9, 2026 869 views

Question details

The user needs to retrieve a specific field value (such as USER_ID) from a nested Microsoft Access subform and pass it to a separately opened popup form to be used as a default value.

How to Pass a Value from a Nested Access Subform to a Popup Form
Product
Microsoft Access
Device & OS
not provided
Scenario
Operating a multi-layered form structure where a standalone popup form needs to initialize using data extracted from a deeply nested subform control.
Observed behavior
Correctly referencing the nested data requires explicitly calling each subform control's name and utilizing their Form properties to successfully pass the data into the popup's Open event.
Before you start

Verify the exact names of your subform controls on the parent forms by checking their Property Sheets, as control names often differ from the names of the source forms themselves.

Solution 1Recommended

Set the Default Value in the Popup Form's Open Event using VBA

Use Visual Basic for Applications (VBA) to dynamically pull the nested subform value into the popup form when it initializes.

A popup form operates independently of the calling form. To fetch a value from a nested subform, you must build a complete reference string chaining the parent forms and their respective subform controls using the .Form property.

When setting a Default Value programmatically for text fields, ensure the passed value is properly wrapped in quotation marks.

1
Open the Popup Form in Design View

Right-click your target popup form in the Access Navigation Pane and select Design View from the context menu.

2
Access the On Open Event

Press F4 to open the Property Sheet. Click on the Event tab, find the 'On Open' property, select [Event Procedure] from the dropdown, and click the ellipsis (...) button to open the VBA editor.

3
Enter the Referencing VBA Code

In the VBA editor, enter the following code (replace the placeholder names with your actual control names): Me.txtUser_ID.DefaultValue = """" & [Forms]![Form A]![Subform B].Form![Subform C].Form![USER_ID] & """"

4
Save and Test the Form

Click the Save icon in the VBA editor, close it, and switch your Access application to Form View. Trigger the popup to verify the default value populates correctly.

Set the Default Value in the Popup Form's Open Event using VBA
String vs. Numeric Values: The multiple quotation marks ("""") are required when passing text strings to a Default Value property. If your USER_ID is a numeric data type, you can omit the extra quotes.
Free Microsoft Office alternative

Looking for a Lightweight, Reliable Office Alternative?

While Microsoft Access is a powerful tool for complex relational databases, WPS Office provides an excellent free, lightweight alternative for managing standard data sets, spreadsheets, and documents. With a familiar UI and broad compatibility, it easily handles your daily office workflows.

  1. 1. Download WPS Office: Visit the official WPS website and download the free installation package for your operating system.
  2. 2. Install the Software: Run the installer and follow the quick on-screen instructions to complete the setup in minutes.
  3. 3. Open Your Data Files: Launch WPS Spreadsheet to seamlessly open, manage, and edit your existing Microsoft Excel and CSV database exports.
Fully compatible with Microsoft Excel, Word, and PowerPoint formats.Lightweight software that consumes minimal system resources and opens files instantly.Free to use with a familiar, intuitive user interface for seamless migration.Powerful built-in spreadsheet tools for robust data sorting, filtering, and management.
microsoft office alternative - wps office

Frequently Asked Questions

Why do I get a '#Name?' error when referencing a nested subform?

This error usually occurs if you use the name of the source form instead of the name of the subform control embedded on the parent form. Always check the subform control's 'Name' property in the Property Sheet.

Do I absolutely need to use the '.Form' property in my reference string?

Yes. The '.Form' property is strictly required because it tells Microsoft Access that you are referring to the actual form object contained within the subform control, rather than the container control itself.

Can I pass a value to the popup if the main form containing the subform is closed?

No. The main form containing the nested subforms must remain open (it can be hidden, but not closed) for the popup form to successfully read the reference path and extract the value.