简体   繁体   中英

“ActiveX component can't create object” in Access 2000 VBA app

I've got a VBA application that throws an "ActiveX component can't create object" exception when trying to run.

在此处输入图像描述

The breakpoint is set on the line that throws the exception:

在此处输入图像描述

I'm assuming that it has something to do with Me.Recordset (Me being the Access form). The recordset is probably related to the Microsoft DAO Library, which is referenced. Here are the current references:

在此处输入图像描述

The application is running on a Windows 98 machine, and the Access.mdb allegedly ran fine before (noone remembers what other computer it was originally on or the configuration of it. The form itself just scrolls through records of data (which works fine), but when firing the above Calc_Confidence_Level() subroutine, it tosses an error on the recordset that I thought would be the same one that it was scrolling through.

Does anyone know what's going wrong here? Even a push in the right direct to be able to debug this better would be great, as I don't exactly work with VBA/Access very often.

Thanks!


Update 1

I looked in "C:\Program Files\Common Files\microsoft shared\DAO\" and don't see a.dll at all, only a.tlb file. There should be a.dll in there, right?

在此处输入图像描述

You should make clear if (1) you have an active recordset in your form, and then (2) if your recordset is an ADODB one, or a DAO one. Usually, when a form is open the standard way (with a 'recordsource' property referring to a local\linked table or view), the recordset is of the DAO type. In these conditions, you need the DAO library. If there is no 'recordsource' property for the form, there is no recordset, or it has to be set 'on the fly', for example in the 'on open' event. You then have to check what kind of recordset is declared in the proc. ('findfirst' is a DAO method, that cannot be used with ADODB recordsets)

Another thing could be to make sure that the form is not corrupted: open a new\empty database, import all objects from your active database, and test it.

You need to reference 'Microsoft DAO xx Object Library'. You only have the DAO compatibility library referenced.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM