Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Open Access database

Posted on 1999-07-24
11
Medium Priority
?
674 Views
Last Modified: 2008-03-10
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 ???
0
Comment
Question by:tell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +3
11 Comments
 
LVL 2

Expert Comment

by:Torus
ID: 1527109
Have you added the DAO reference in your project?
0
 
LVL 3

Expert Comment

by:schworak
ID: 1527110
It needs to be DAO 3.5 or higher it is under project/reference on your menu.
0
 

Author Comment

by:tell
ID: 1527111
Reference DAO 3.51 is added in my project.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:tell
ID: 1527112
... and I already re-installed VB 5.0 just in case I damaged the DLL somehow.
0
 
LVL 8

Expert Comment

by:vettranger
ID: 1527113
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.


0
 

Author Comment

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

???

0
 
LVL 2

Expert Comment

by:Torus
ID: 1527115
have you run in debug mode and make sure that the error is owing to
the Set gDatabase = OpenDatabase(gsDatabaseName, False, False)  statement?
0
 

Author Comment

by:tell
ID: 1527116
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?
0
 
LVL 15

Expert Comment

by:ameba
ID: 1527117
Can you open it by using VISDATA (Visual Data Manager)?
Try repairing your MDB.
0
 
LVL 8

Expert Comment

by:vettranger
ID: 1527118
Also try positioning your reference to DAO as high in the reference list as possible.
0
 
LVL 1

Accepted Solution

by:
can9999 earned 400 total points
ID: 1527119
If you'd added DAO 3.5 or else,

Public tWs as Workspace
Public tDb as Database
Public tRs as Recordset

public sub openaccessdb()
dim sSql$

   Set tWs = Workspaces(0)

   Set tDb = tWs.Opendatabase("test.mdb")

   sSql = "SELECT * FROM Test"   ' if your test table name is "Test"

   Set tRs = tDb.Openrecoedset(sSql)

end sub
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question