logo
search
Others

How to Fix Access Run-Time Error 3021 When Updating a Subform

Steven ParkerSteven Parker Oct 22, 2026 868 views

Question details

The user needs to resolve run-time error 3021 ('No current record') in Microsoft Access when dynamically changing a subform's RecordSource.

How to Fix Access Run-Time Error 3021 When Updating a Subform 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.
Before you start

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.

Solution 1Recommended

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.

1
Open Form in Design View

Open your Microsoft Access database, navigate to the main form where the subform resides, and open it in Design View.

2
Access the VBA Editor

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.

3
Add the Reassignment Code

Add a line of code to reassign the subform control's SourceObject to its existing value. For example: Me.YourSubformControlName.SourceObject = Me.YourSubformControlName.SourceObject

4
Save and Test

Save the VBA code, switch back to Form View, and test the selection to verify that the runtime error 3021 is resolved.

Quick Fix: This single line of code often resolves complex event timing issues without requiring a major redesign of your forms.
Free Microsoft Office alternative

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. 1. Download the Software: Visit the official WPS Office website to download the free suite for your operating system.
  2. 2. Install and Launch: Follow the straightforward installation wizard, then open WPS Spreadsheet.
  3. 3. Manage Your Data: Easily open, edit, and organize your existing Excel data tracking files without complex database setup.
Fully compatible with Microsoft Excel formats (.xlsx, .xls, .csv).Supports advanced spreadsheet functions, pivot tables, and comprehensive data analysis tools.Provides a lightweight, familiar tabbed interface for seamless migration from Microsoft Office.Free to use, reducing software overhead for everyday data management tasks.
microsoft office alternative - wps office

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.