XL97: Run-Time Error Using CreateObject With DAO.DBEngine (157471)
The information in this article applies to:
- Microsoft Excel 97 for Windows
This article was previously published under Q157471 SYMPTOMS
When you use CreateObject in a Microsoft Excel 97 macro to use Data
Access Objects (DAO), you may receive the following error:
Run-time error '429':
ActiveX component can't create object
CAUSE
If DAO 3.0 is not installed and you use the following line of code:
Set x = CreateObject("DAO.DBEngine")
you will receive the error message described in the "Symptoms" section.
NOTE: This line of code will successfully create, without error, a DAO 3.0
object if DAO 3.0 is installed on your computer.
RESOLUTION
With DAO 3.0, the object name is "DAO.DBEngine" and with DAO 3.5, the
version provided with Microsoft Excel 97, the object name has changed to
"DAO.DBEngine.35". So, if you have DAO 3.5 installed, the following line of
code will create, without error, a DAO 3.5 object:
Set x = CreateObject("DAO.DBEngine.35")
Since the object names for DAO 3.0 and DAO 3.5 are different, it is
recommended that you avoid using CreateObject altogether with DAO for your
code to be compatible with both versions of DAO.
Instead of using CreateObject to use DAO in your macro, check the
appropriate Data Access Object Library in the References dialog box:
- With a module sheet active, click References on the Tools menu.
- Check the "Microsoft DAO <x.x> Object Library" (where <x.x> is the DAO
version) and click OK.
REFERENCES
For more information about Data Access Objects, type the following text in
the Office Assistant Window:
and click Search. Then click the topic "Data Access Objects and Collections
Reference".
Modification Type: | Minor | Last Reviewed: | 10/10/2006 |
---|
Keywords: | kbdtacode kberrmsg kbProgramming KB157471 |
---|
|