How to Fix Access Run-Time Error 3021 When Updating a Subform
Question details
The user needs to resolve run-time error 3021 ('No current record') in Microsoft Access when dynamically changing a subform's RecordSource.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Updating a subform RecordSource in Microsoft Access when selecting a new account or record, causing the subform Current event to fire prematurely.
- Observed behavior
- Microsoft Access throws run-time error 3021 ('No current record') because the VBA code attempts to read fields before the newly requeried recordset has a current record.
Ensure you have access to the VBA editor in Microsoft Access and save a backup copy of your database before modifying form events or VBA code.
Reassign the Subform's SourceObject Property
Refresh the subform by reassigning its SourceObject property to the exact same value, which prevents the Current event from firing prematurely during a requery.
When using Master/Child linking fields alongside dynamic criteria from the main form, the subform's Current event can fire before the data is ready. Reassigning the SourceObject forces a clean reload of the subform control.
Open your Microsoft Access database, navigate to the main form where the subform resides, and open it in Design View.
Locate the event procedure (such as a combo box or tab control's Change/AfterUpdate event) used to select a new record, and click the ellipsis (...) to open the VBA Editor.
Add a line of code to reassign the subform control's SourceObject to its existing value. For example: Me.YourSubformControlName.SourceObject = Me.YourSubformControlName.SourceObject
Save the VBA code, switch back to Form View, and test the selection to verify that the runtime error 3021 is resolved.
Use a Bound Form with an Unbound Combo Box
Avoid subform event sequence issues entirely by using a single bound form with an unbound combo box in the header for filtering.
Debug Events and Add EOF/BOF Checks
Step through the VBA code line by line to identify where the current record is missing and add logical checks before reading fields.
Manage Your Data Easily with WPS Office
While Microsoft Access is a powerful tool for relational databases, many data tracking and record management tasks can be efficiently handled using spreadsheets. WPS Office provides a lightweight, highly compatible, and free alternative to Microsoft Office, featuring robust spreadsheet capabilities that support advanced data analysis and seamless file compatibility.
- 1. Download the Software: Visit the official WPS Office website to download the free suite for your operating system.
- 2. Install and Launch: Follow the straightforward installation wizard, then open WPS Spreadsheet.
- 3. Manage Your Data: Easily open, edit, and organize your existing Excel data tracking files without complex database setup.

Frequently Asked Questions
What does run-time error 3021 'No current record' mean in Microsoft Access?
This error occurs when Microsoft Access attempts to read, modify, or interact with a record in a recordset, but no valid record exists. This frequently happens if the recordset is empty, or if the VBA code tries to access data before the subform's recordset has fully loaded.
How do I prevent error 3021 when working with Recordsets in VBA?
To prevent this error, always check the End of File (EOF) and Beginning of File (BOF) properties of your recordset before attempting to read field values. For example, using the statement 'If Not rs.EOF Then' ensures that a valid record exists before proceeding.
Why does my subform Current event fire multiple times?
The Current event can fire multiple times if the main form and subform are linked via Master/Child fields and the record source criteria are updated dynamically. Reassigning the subform's SourceObject property can help control when these events trigger and prevent premature code execution.




