Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Class Not Registered error 1

Status
Not open for further replies.

sdillard

Technical User
Oct 23, 2001
32
0
0
US
I use Access 2000. I recently moved my databases to a new PC running Win XP from my old one running Win 2000. Win I try to run my VBA modules on the new PC, I get a "Class Not Registered" error on the following step:

rs.Open "[Table_Agent]", CurrentProject.Connection, adOpenKeyset, adLockOptimistic

I originally had MDAC 2.5 on both PCs but downloaded and installed MDAC 2.8 on the new one while trying to fix the problem. I also downloaded the most current version of Jet. The CurrentProject.Connection appears to be the problem but I can't figure out why.

Any help would be greatly appreciated.

Scott
 
Open Tools/Refrences in the code window, see if you have a reference to Microsoft DAO object 3.6.
 
Yes. It is there but not selected. I selected it and tried to run the function, but it still go the same message.
 
Do you anything else listed as "MISSING" in the reference list?
 
rs.Open "[Table_Agent]", CurrentProject.Connection, adOpenKeyset, adLockOptimistic

Could you post the Set and Dim statements for the rs object?
 
Nothing shows up as missing in the references.

In the past, I haven't used a Set statement. Here is my Dim statement;

Dim rs As New ADODB.Recordset

I have never had a problem with this before switching machines and operating systems. While trying to figure out what might be wrong, I did try to set up a connection and to Jet and received an error message that said "Provider Cannot Be Found". However, I have downloaded and installed the latest version of Jet only a few hours ago.
 
Ok, you are using ADO, so my suggestion to add DAO was in error. Instead check to see if you have a reference to ADO 2.6
also you might want to replace CurrentProject.Connection with a global OLEDB connection object:
Public LocalDb as new ADODB.Connection
in your function add:

Call OpenLocalDb("")

rs.Open "table_Agent", LocalDB, adOpenKeyset, adLockOptimistic,adCmdTable

Here is the OpenLocalDb function
Function OpenLocalDB(ByVal dbname As String)


On Error GoTo OpenLocalDBConnection_err

Set Localdb = New ADODB.Connection
If dbname = "" Then
Set Localdb = CurrentProject.Connection
Else
Localdb.Open ("Provider=Microsoft.jet.OLEDB.4.0;Data Source=" + dbname)
End If



OpenLocalDB = True

Exit Function

End Function
A few other things:

"[Table_Agent]"
I've never seen brackets on the table name, you might try removing this

rs.Open "[Table_Agent]", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
is usually
rs.Open "Table_Agent", CurrentProject.Connection, adOpenKeyset, adLockOptimistic,adCmdTable

 
Something I noticed is that my ADO lib is 2.1. How do I get 2.6.
 
I figured out how to change it to 2.6 but that didn't fix the problem.
 
I used the code you provided and I did it two ways. The first try I left the dbName = "". The second try I entered the full path to the db. On the first try I received the Class not registered error. On the second try, I received the "Provider cannot be found. It may not be properly installed." error.
 
I am suspecting that I have some corrupted jet or ADO files? If I uninstall Access, and then reinstall it, will the files be replaced?
 
Yes. I think you may be right. Sounds like something didn't hit the registry.
 
Well, I uninstalled and reinstalled Office 2000 but that didn't fix the problem. On the Microsoft support site it says that you can't uninstall MDAC from an XP installation because it is part of the XP load. I am going to check with our PC guys and find out how he loaded XP (it may have been preloaded from the manufacturer). My next step may need to be relaoding XP Professional.

Thanks for your help. Any other suggestions would be appreciated.
 
Towards the bottom of this web page it gives the correct steps for reinstalling MDAC. It also has a test to do that specfically uses Access under the heading
"I think MDAC setup worked, how can I verify that MDAC is setup correctly?" You might want to do the test, it might verify you have an MDAC problem.

 
Thanks. When I ran the tests I was able to set up a datalink with ODBC but not with Jet. Received an error message saying "Test connection failed because of an error initializing provider. Unrecognized database format."

The ODBC Administrator test worked fine.
 
I am having the same problem you posted re:"class not registered". I was wondering if you ever found out the solution to the problem. I would appreciate any help you could offer.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top