Microsoft Access: Reference and Filter a Subform
Question details
The user wants to reference a subform on a tabbed main form and show records related to the selected parent record.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- A main form contains a subform on a tab, and the subform should display records matching the current parent record.
- Observed behavior
- The goal is to use the correct subform reference and keep its records matched to the current parent record.
Open the main form in Design View and identify the subform control name in its Property Sheet; it may differ from the name of the form it displays. Check the parent control and child field names and their data types before setting links or writing a filter.
Link the Subform to the Current Parent Record
Use linked fields when the subform should automatically show child records related to the current parent record.
Open the main form in Design View, select the subform control on its tab, and open the Property Sheet. Confirm that the selected object is the subform control rather than a control inside the subform.
On the Property Sheet's Data tab, set Link Master Fields to the parent control or field, such as COD_PRODUCTO, and Link Child Fields to the corresponding field in the subform's record source.
Save the form, open it in Form View, and move between parent records. The subform should update to show matching child records without an additional filter.

Apply a Filter Through the Subform Control
Use a VBA filter when you need explicit control over which subform records are displayed.
Work With Related Office Files in WPS Office
WPS Office is a free, lightweight alternative for everyday document and spreadsheet work. Its familiar interface and Microsoft Office format compatibility make it easy to move supported files between suites. It does not fix Access subform references or replace an Access database application.

Frequently Asked Questions
Do I need a VBA filter if the subform is linked?
Usually not. Set Link Master Fields and Link Child Fields on the subform control's Data tab, then test navigation between parent records in Form View.
How do I find the name to use in a subform reference?
In the main form's Design View, select the subform control and check its Name on the Property Sheet. Use that control name before the Form property, even if the displayed form has a different name.
Does the tab name belong in the subform reference?
Normally, no. A subform control placed on a tab can be referenced from the main form as Me!SubformControlName.Form.
What changes if COD_PRODUCTO is a text field?
The filter expression must quote the text value and escape any embedded quote characters. The numeric example shown in the VBA solution should not be used unchanged for a text key.




