Microsoft Access users may encounter the ‘Macro Single Step error 2001’, when trying to make a directory by running a VBA script or using the Autoexec macro in MS Access. Sometimes, due to this error, the Microsoft Access application crashes with the runtime error AutoExec 2001.
This error may also appear when using the single step command in debugging mode in MS Access to execute a macro. When each action completes, a dialog box appears with information, such as Macro Name, Action Name, Arguments, and error code.
There are several reasons that may lead to such an error. Let’s discuss the reasons for this error and the solutions to resolve it.
Reasons for Macro Single Step Error 2001
Here are some possible reasons behind the macro single step error 2001:
- The database is stored at an untrusted location.
- The MS Access database is corrupt.
- The location of the database is incorrect.
- Missing references.
Methods to Fix Macro Single Step Error 2001
Here are some methods to fix macro single step error 2001.
Setup a New Trusted Location
The macro single step error may occur when you open an untrusted database or access the database from an untrusted location. In such a case, you can try moving the database file to a trusted location – a folder that can be considered safe to execute the code. Here are the steps to set up a new trusted location:
- Open Microsoft Access.
- Go to File > Options.
- In the Access Options dialog box, click Trust Center.
- Click Trust Center Settings under Microsoft Office Access Trust Center.
- Click on the Locations option in the left pane of the Trust Center wizard. The Trusted locations dialog box is displayed.
- Click on the Allow Trusted Locations on my network checkbox to add a network location.
- Click Add New location.
- Use one of the following options in the Microsoft Office Trusted Location dialog box:
- In the Path field, write the path of the location you need to add.
- Use the Browse button to browse to the location.
- Select Subfolders of this location are also trusted, if you want to specify the subfolders.
- After adding the location, click OK.
Use SingleStep Macro Action
The SingleStep macro action in MS Access is used to pause macro execution and display the Macro Single Step dialog box. The dialog box displays information about the current action of the macros. It includes the macro name, action names, error number, arguments, etc. You can add a SingleStep action to a macro to check and troubleshoot the issue with macros. The steps are as follows:
- Open Microsoft Access.
- Go to File > Create.
- Right-click on the macro in left pane and choose Design View.
- In the Design View search bar, find SingleStep.
- Drag the SingleStep macro action and drop it on the design window where you want to start single step action.
- Click Step to go to the next macro action.
- Click Stop All Macros to stop the current macros or continue to stop single step action and resume the normal macro execution.
Delete the Missing References
If your document contains a Visual Basic function or database has missing objects or broken references, you may receive the “macro single step error 2001”. In such a case, you can remove the missing references.
To remove the missing references, follow these steps:
- Open your Access database.
- Press the ALT + F11 keys. It will display the Microsoft Visual Basic for Applications window.
- Click Tools > References.
- On References window, uncheck the checkboxes for the type library.
You can also restore the reference file to a specified path. If the reference file is at a new location, unselect the checkbox for the Missing: <referencename> and then create a new folder to create a new reference.
Repair the Database
You may also experience the macro single-step error if the database is corrupt. In such a case, you can run the Compact and Repair utility to repair the damaged or corrupt database files. Follow these steps:
- Open Microsoft Access.
- Go to File > Info > Compact & Repair Database.
- Choose the corrupt Access database file and then click OK.
After repairing the database, check if the error is resolved.
If Microsoft’s built-in ‘Compact & Repair Database’ utility fails to repair the database, you can use Stellar Repair for Access to repair the database file. This tool can easily repair corrupted Access database file (ACCDB/MDB) and recover all the components, such as forms, modules, reports, etc. The software is compatible with all Microsoft Access versions.
Closure
The macro single step error 2001 can occur due to various reasons. This blog outlined the reasons behind the Access error ‘macro single step error 2001’. It also discussed the workarounds to help you troubleshoot the issue. If the error has occurred due to corruption in the database, you can use the Compact and Repair utility. If it fails, you can use Stellar Repair for Access to repair and restore all objects from the database file.
Was this article helpful?