Others

How to Fix #Name? Error for Attachment.FileName in Access Subforms

Olivia MillerOlivia Miller Nov 3, 2026 870 views

Question details

The user is encountering a #Name? error when attempting to display an Attachment.FileName control inside a subform.

How to Fix #Name? Error for Attachment.FileName in Access Subforms
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.
Before you start

Verify the exact names of your main form, the subform container control, and the specific control displaying the error before editing the control source.

Solution 1Recommended

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.

1
Open Main Form in Design View

Right-click your main form in the Access navigation pane and select 'Design View'.

2
Identify Subform Container Name

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.

3
Access the Problematic Control

Click inside the subform to select the Attachment control that is currently displaying the #Name? error.

4
Update Control Source Property

In the Property Sheet, go to the 'Data' tab. Change the 'Control Source' property to use the full hierarchy: =[Forms]![MainFormName]![SubformContainerName].[Form]![ControlName].

5
Save and Test

Save the form changes and switch to Form View to verify that the attachment file name now displays correctly without the #Name? error.

Update the Control Source Reference Hierarchy
Subform Container vs Subform Source: Always use the name of the Subform Container control located on the main form, which may be different from the actual source object name of the subform itself.
Free Microsoft Office alternative

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. 1. Download the Installer: Visit the official WPS website and download the free installation package for your operating system.
  2. 2. Install WPS Office: Run the downloaded file and follow the quick setup wizard to install the software.
  3. 3. Open Your Office Files: Launch WPS Office and directly open your existing Word, Excel, or PowerPoint files without losing any formatting.
Fully compatible with Microsoft Office formats including .docx, .xlsx, and .pptx.Lightweight installation that uses minimal system resources and opens files instantly.Familiar tabbed interface makes transitioning from Microsoft Office seamless.All-in-one platform integrating Word, Excel, PowerPoint, and PDF editing features.
microsoft office alternative - wps office

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.