Link to home
Start Free TrialLog in
Avatar of tell
tell

asked on

Open Access database

I'm trying to open my Access 97 database "test.mdb" in Visual Absic 5.0 under Windows 98 with the following code:

Global gDatabase As Database
Global gsDatabaseName As String

gsDatabaseName = "C:\Test.mdb"
Set gDatabase = OpenDatabase(gsDatabaseName, False, False)

and get the runtime error 429 (ActiveX component can't create object).

Can anybody give me advice ???
Avatar of Torus
Torus

Have you added the DAO reference in your project?
It needs to be DAO 3.5 or higher it is under project/reference on your menu.
Avatar of tell

ASKER

Reference DAO 3.51 is added in my project.
Avatar of tell

ASKER

... and I already re-installed VB 5.0 just in case I damaged the DLL somehow.
Following is the only note in the help file for RT 429 that sounds reasonable. Do you by any chance have the database open with access while you're trying to run your VB program?

"Access to the object has explicitly been denied.
For example, you may be trying to access a data object that's currently being used and is locked to prevent deadlock situations. If that's the case, you may be able to access the object at another time."

I started a new project, then

dropped your Global statements into a module, then

dropped your two program statements onto a command button, changing the filename to a database on my system, then

added the DAO 3.51 library under project references

I then ran the project and click the button, it ran fine.


Avatar of tell

ASKER

Sorry, but my database is not openend by another application while I'm trying to run my project.

???

have you run in debug mode and make sure that the error is owing to
the Set gDatabase = OpenDatabase(gsDatabaseName, False, False)  statement?
Avatar of tell

ASKER

Yes I ran my project in debug mode and the error comes from the open database statement.
Maybe my DLL on the installation disk is damaged. Where can I get a new file?
Can you open it by using VISDATA (Visual Data Manager)?
Try repairing your MDB.
Also try positioning your reference to DAO as high in the reference list as possible.
ASKER CERTIFIED SOLUTION
Avatar of can9999
can9999

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial