How to Fix #Name? Error for Attachment.FileName in Access Subforms
Question details
The user is encountering a #Name? error when attempting to display an Attachment.FileName control inside a subform.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Designing or viewing forms that utilize subforms to display records containing attachment fields.
- Observed behavior
- The attachment control displays data correctly on a standalone Access form, but shows a #Name? error when placed inside a subform.
Verify the exact names of your main form, the subform container control, and the specific control displaying the error before editing the control source.
Update the Control Source Reference Hierarchy
Modify the control source reference to include the complete path, specifying the main form and the subform container.
When an Access form is embedded as a subform, simple control references (like Forms!FormName!ControlName) break because the context changes. Access requires a fully qualified reference that maps the hierarchy from the main form down to the subform control.
Right-click your main form in the Access navigation pane and select 'Design View'.
Click on the edge of the subform to select the subform container (not the form inside it). Open the Property Sheet and note the 'Name' property under the 'Other' tab.
Click inside the subform to select the Attachment control that is currently displaying the #Name? error.
In the Property Sheet, go to the 'Data' tab. Change the 'Control Source' property to use the full hierarchy: =[Forms]![MainFormName]![SubformContainerName].[Form]![ControlName].
Save the form changes and switch to Form View to verify that the attachment file name now displays correctly without the #Name? error.

Need a Faster, Lighter Office Suite? Try WPS Office
While Microsoft Access is used for complex relational database management, your daily document, spreadsheet, and presentation needs can be handled more efficiently. WPS Office offers a completely free, lightweight, and highly compatible alternative to Microsoft Office suites.
- 1. Download the Installer: Visit the official WPS website and download the free installation package for your operating system.
- 2. Install WPS Office: Run the downloaded file and follow the quick setup wizard to install the software.
- 3. Open Your Office Files: Launch WPS Office and directly open your existing Word, Excel, or PowerPoint files without losing any formatting.

Frequently Asked Questions
Why does the #Name? error only appear when the form is used as a subform?
When a form is run independently, simple references are valid because the controls are in the current local scope. When embedded as a subform, the form becomes a child object of the main form, and Access can no longer resolve simple local references without the full hierarchical path.
What is the difference between a subform and a subform container?
The subform is the actual form object created in the database. The subform container is the physical control placed on the main form that holds and displays the subform. Reference paths must always use the container's name.
Does this reference method apply to other control types besides Attachment.FileName?
Yes, this standard Access hierarchical referencing rule applies to text boxes, combo boxes, list boxes, and any other bound or unbound controls placed inside a subform.




