View Full Version : VBA & ACCESS

2004-06-08, 05:06 AM

I have a VBA module which is connecting to an Access database. The module is used on two computers:
- one with Windows 98, AutoCAD 2000i and Access 2000
- the other with Windows 2000, AutoCAD 2002 and Access 2000.

In Reference window in both cases I have:
- Visual Basic For Application
- AutoCAD 2000 Type library
- OLE Automation
- Microsoft Froms 2.0 Object Library
- Microsoft Acces 9.0 Object Library
- MIcrosoft DAO 3.51 Object library

The code used to connect to database is this:

Dim WS As Workspace
Dim DB As Database
Dim strDatabasePAth as string

For a few days on computer with Winows 2000 I get the error "ActiveX component can't create object" when I arrive here:

Set WS = DBEngine.Workspaces(0)
Set DB = WS.OpenDatabase(strDatabasePath)

Can you help me, please?
Thank you!

Ed Jobe
2004-06-08, 02:37 PM
Are you trying to open another db, other than the currently open one? I notice that you have acad 2002 on this machine, but reference the 2000 lib. Do they both use the same? I ask since I don't have 02.

2004-06-09, 04:44 AM
The VBA module and databases are the same on the two computers.
A few weeks ago when I used, it worked on Windows2000 computer too, but a few days ago when I tryed again I got that error.

2004-06-21, 11:29 AM
Look at the refferences in your project. See if MSAcces is checked.