Open the Selected Subform Record in a Microsoft Access Popup Form
Question details
Open a popup form to the record selected in a subform.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- A button on a form opens a popup note form for the currently selected subform record.
- Observed behavior
- The popup may open a new record instead of the matching selected record.
Identify the main form name, the subform control name, and the control that holds CommunicationID. Confirm that the popup form's record source includes the matching CommunicationID field.
Pass the Selected CommunicationID to the Popup Form
Use a fully qualified subform reference and filter the popup to the selected numeric ID.
Open the main form in Design View, select the subform container, and check its Name on the Property Sheet. This control name may differ from the name of the form displayed inside it.
Select the button that opens the popup. On the Property Sheet's Event tab, set On Click to [Event Procedure] and click the build button to open the VBA editor.
In the button's Click procedure, use the following example, replacing MainFormName, SubformControlName, and CommunicationID with your actual names: Dim selectedID As Variant selectedID = Forms!MainFormName!SubformControlName.Form!CommunicationID If IsNull(selectedID) Then MsgBox "Select a record with a CommunicationID first." Exit Sub End If DoCmd.OpenForm "PopupComNoteF", WhereCondition:="[CommunicationID]=" & selectedID
Open PopupComNoteF in Design View and set Data Entry to No on its Property Sheet. Save the forms, select an existing subform record, and click the button to verify that the popup shows the matching note.

Use WPS Office for Everyday Documents and Spreadsheets
WPS Office is a free, lightweight alternative for common Office work, with a familiar interface and support for Microsoft Office file formats. It can help you move document and spreadsheet work across, but it does not run or repair Microsoft Access forms or VBA database applications.

Frequently Asked Questions
Why does the subform reference include .Form?
The subform control is a container on the main form. Its Form property gives you access to the controls on the form displayed inside it, as in Forms!MainFormName!SubformControlName.Form!CommunicationID.
How do I find the subform control name?
Open the main form in Design View, select the subform container, and check Name on the Property Sheet. Use that name in the reference, even if the form inside has a different name.
Why does the popup still open to a new record?
In the popup form's Property Sheet, check that Data Entry is set to No. Also confirm that its record source includes CommunicationID and that the selected ID matches an existing record.
Can WPS Office run this Access popup form?
No. This solution requires Microsoft Access because it uses Access forms, the Forms collection, and Access VBA. WPS Office can be used separately for compatible documents and spreadsheets.




