View all FMS products for Microsoft AccessMicrosoft Access "Class Not Registered" Run-time Error '-2147221164 (80040154)'

Written by Luke Chung, FMS President

You've created a Microsoft Access database solution and have successfully distributed it to many people. Everyone is running it properly but one machine is triggering this error. The error message makes no sense and everything you try fails to resolve the problem. What's going on?

Symptom

The MS Access database actually runs so it's compiled and functional. It doesn't seem corrupt since others can run the same database, yet this error appears when very simple ADO code such as CurrentProject.Connection is run to open a table or query recordset:

Class not registered Run-time error -2147221164 (80040154)

We've actually had reports of this problem for years but were never able to reproduce the problem. We finally did and have a solution.

"Class Not Registered" is Unclear

The "Class Not Registered" message is very confusing. Which class is not registered? And what's the problem with this machine when the database runs successfully on other PCs?

The message implies it is caused by code that won't compile, but the code compiles and is running fine before this crash occurs. Common techniques such as decompiling the database make no difference.

Is it a broken library reference? Checking the list of referenced libraries doesn't reveal any problems. Is the database corrupt?

The symptom can exist if you create a new database and run this in the Immediate Window:

? CurrentProject.Connection

This simple test effectively rules out any issues associated with your database. This basic Microsoft Access VBA command won't even run on a blank database.

Potential Causes

The CurrentProject object is part of Microsoft Access. It's not something a developer adds. The problem exists within MS Access, not your database, so the fix is at the Access/Office level.

One of the causes for this error appears to be related to uninstalling another version of Access after your version of Access was installed. This may include uninstalling runtime versions of Access.

For instance, your machine may have Access 2007 installed on it. Access 2013 was later installed, and then Access 2007 uninstalled. Access 2013 seems to be running properly but it fails when this code is run. For some reason, the uninstallation of the prior version of Access makes the current one you're running unstable.

It may also be related to the installation of Windows updates and security patches. And of course, it could be caused by unknown file corruptions. Thankfully, this error doesn't happen often.

Solution: Repair Microsoft Office Access

The solution we've found is very straightforward. Just fix (repair) the installation of Microsoft Office/Access. You may need Administrator permissions to do this.

Go under the Control Panel, Programs, Programs and Features, select "Microsoft Office Professional Plus 2013" (or your version of Access) and click on Change:

Control Panel, Programs and Features, Microsoft Office Access

When the next screen appears, select Repair:

Repair Microsoft Access Office

It takes a while, but after Office and Access are repaired, the problem goes away.

Confirm it's fixed by running Microsoft Access, opening a database, and testing CurrentProject.Connection in the Immediate Window. It should now work.

If it doesn't work, you may need to uninstall and reinstall Microsoft Office and Access.

FMS Development Team BlogBlog about it here.

Hope this helps!

Table Design

Query Design

Form Design

Form Tips and Mistakes

Module VBA to Forms and Controls

Form Navigation Caption

Using a RecordsetClone

Synchronize Two Subforms

Multiple OpenArgs Values

Late Bind Tab Subforms

Subform Reference to Control Rather than Field

Tab Page Reference

Shortcut Keys


Combo Box Top Tips

Properties and Validation

Select First Item

Cascading Combo Boxes

Zip, City, State AutoFill

Report Design

Suppressing Page Headers and Footers on the First Page of Your Report

Add the NoData Event

Annual Monthly Crosstab Columns

Design Environment

Adding Buttons to the Quick Access Toolbar

Collapsing the Office Ribbon for more space

VBA Programming

Basics: Forms and Controls

Using Nz() to Handle Nulls

Avoiding Exits in the Body of a Procedure

Shortcut Debugging Keys

Setting Module Options

Math Rounding Issues

Rename a File or Folder

Avoid DoEvents in Loops

Age Calculations

Weekday Math

Sending Emails with DoCmd.SendObject

Source Code Library

Microsoft Access Modules Library

Microsoft Access Modules

VBA Error Handling

Error Handling and Debugging Techniques

Error Number and Description Reference

Basic Error Handling

Pinpointing the Error Line

Performance Tips

Linked Database

Subdatasheet Name

Visual SourceSafe

Deployment

Runtime Downloads

Simulating Runtime

Prevent Close Box

Disable Design Changes

Broken References

Remote Desktop Connection Setup

Terminal Services and RemoteApp Deployment

Reboot Remote Desktop

Missing Package & Deployment Wizard

Avoid Program Files Folder

Microsoft Access Front-End Deployment

System Admin

Disaster Recovery Plan

Compact Database

Compact on Close

Database Corruption

Class Not Registered Run-time Error -2147221164

Inconsistent Compile Error

Decompile Database

Bad DLL Calling Convention

Error 3045: Could Not Use

Converting ACCDB to MDB

SQL Server Upsizing

Microsoft Access to SQL Server Upsizing Center

Microsoft Access to SQL Server Upsizing Center

When and How to Upsize Access to SQL Server

SQL Server Express Versions and Downloads

Cloud and Azure

Cloud Implications

MS Access and SQL Azure

Deploying MS Access Linked to SQL Azure

Visual Studio LightSwitch

LightSwitch Introduction

Comparison Matrix

Additional Resources

Connect with Us

 

Free Product Catalog from FMS