Others

Fix Access 2016 Error 2501 When Opening a Form

Algirdas JasaitisAlgirdas Jasaitis Nov 20, 2026 868 views

Question details

Resolve runtime error 2501 when opening an Access 2016 form after converting an embedded macro to VBA.

Fix Access 2016 Error 2501 When Opening a Form
Product
Microsoft Access 2016
Device & OS
not provided
Scenario
A form is opened from a button or another procedure after an embedded macro has been converted to Visual Basic for Applications.
Observed behavior
Access reports runtime error 2501 when the form-opening action is canceled.
Before you start

Identify the button or procedure that calls DoCmd.OpenForm and note the target form name. Check the target form's On Open event for code that sets Cancel to True, since error 2501 can indicate a canceled action rather than a damaged form.

Solution 1Recommended

Re-create the affected form in the database

Try cutting and pasting the form back under its original name if the form may be damaged.

The cause cannot be confirmed without examining the database. Test this procedure in a copy first, because removing and replacing a form can affect references or settings.

1
Open a database copy

In Access, open a copy of the database and close the affected form and any forms that use it.

2
Cut the form

In the Navigation Pane, right-click the affected form, note its exact name, and select Cut.

3
Paste it back

Right-click the Navigation Pane and select Paste. Enter the original form name if Access prompts for a name.

4
Test the form

Open the form from the same button or procedure that produced the error. Also test any forms that reference it.

Re-create the affected form in the database
If the error continues: Inspect the form's On Open and On Load event code for the reason the action is canceled before treating error 2501 as expected.
Free Microsoft Office alternative

Use WPS Office for everyday Office documents

WPS Office is a free, lightweight alternative for working with documents, spreadsheets, and presentations in a familiar interface. It supports common Microsoft Office formats for easier migration, but it does not fix Access errors or run Access forms.

Open and edit common Microsoft Word, Excel, and PowerPoint formatsWork with spreadsheets and other Office files in a familiar interfaceUse a free, lightweight suite for everyday document tasks
QA img-9

Frequently Asked Questions

What does Access error 2501 mean when opening a form?

It means the action was canceled. Check the target form's On Open event and the calling procedure to find out why; the error alone does not prove the form is damaged.

Where can I find the code that opens the form?

Open the calling form in Design View, select the button, and check Property Sheet > Event > On Click. Open the event procedure and look for DoCmd.OpenForm.

Should I always ignore error 2501?

No. Ignore it only when you have confirmed that the cancellation is expected. Otherwise, investigate the form's event code and any other errors that occur while it opens.

Does WPS Office repair Access forms or run Access VBA?

No. WPS Office is an alternative for documents, spreadsheets, and presentations; it does not repair Microsoft Access forms or run Access form VBA.