How to Fix Access Subform Macro Cannot Find a Parent Form Control
Question details
The user needs to hide or modify a label on an Access parent form from a subform, but standard macros fail to locate the target control.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Attempting to control the visibility of a parent form element from within a subform using a SetProperty macro.
- Observed behavior
- The macro fails to find the control on the parent form, triggering errors such as 2165, 3070, 32004, or 3021.
Verify the exact name of the parent form control you want to modify, and ensure your database is backed up before replacing macros with VBA code.
Use VBA to Reference the Parent Form Control
Converting the macro to VBA code provides a reliable way to reference and manipulate parent form controls using the 'Me.Parent' syntax.
Standard Access macros often struggle with cross-form referencing, especially when dealing with navigation forms or unlinked record sources. Visual Basic for Applications (VBA) explicitly defines the object hierarchy, ensuring the subform can successfully locate the parent control.
Right-click your subform in the Navigation Pane and select 'Design View'.
Select the control that triggers the action. In the Property Sheet, go to the 'Event' tab, select '[Event Procedure]' for your desired trigger (e.g., On Click), and click the ellipsis (...) button to open the VBA editor.
Inside the VBA subroutine, type the following expression: Me.Parent.YourControlName.Visible = False. Replace 'YourControlName' with the exact name of the label or control on the parent form.
Save the VBA code, close the Visual Basic editor, and switch your main form to 'Form View' to verify that the control hides successfully.

Boost Your Productivity with WPS Office
While Microsoft Access handles complex database management, your everyday document, spreadsheet, and presentation tasks can be executed seamlessly with WPS Office. It is a lightweight, fully compatible suite designed to handle standard Office files with exceptional efficiency.
- 1. Download the Installer: Visit the official WPS website and click the free download button to get the installer for your operating system.
- 2. Install WPS Office: Run the downloaded file and follow the straightforward on-screen instructions to complete the installation.
- 3. Open and Edit Files: Launch WPS Office and instantly open your existing .docx, .xlsx, or .pptx files to begin working without compatibility issues.

Frequently Asked Questions
Why does the Access SetProperty macro fail with error 32004?
Error 32004 usually occurs when the macro cannot evaluate the object reference. Macros have limited scope compared to VBA and often fail to bridge the context between a subform and a parent navigation form.
What does 'Me.Parent' mean in Access VBA?
In Access VBA, 'Me' refers to the current form where the code is executing (the subform), while 'Parent' specifically calls the main form that contains the subform control.
Can I convert my existing Access macros to VBA automatically?
Yes, you can easily convert macros to VBA. Open the form in Design View, select the 'Form Design' tab on the ribbon, and click 'Convert Form's Macros to Visual Basic'.




