[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

DBEngine object not found in Excel

Posted on 1998-11-04
12
Medium Priority
?
737 Views
Last Modified: 2013-12-25
Hi,

I'm writing a little VB module that is to export data from
Excel 7.0 to an Access 7.0 Database file. I try to create a
Database Object using DBEngine.OpenConnection,
however I always get run-time error 424 - "Object
Required". Any ideas why the DBEngine object cannot
be found?

Thanx
0
Comment
Question by:bogie2
  • 3
  • 3
  • 2
  • +3
12 Comments
 

Author Comment

by:bogie2
ID: 1497434
Edited text of question
0
 
LVL 2

Expert Comment

by:Poddy
ID: 1497435
you need to add the DAO to your references
0
 

Author Comment

by:bogie2
ID: 1497436
I DO have a reference to the DAO library! And it still does not find the
object DBEngine. Very strange. Could it be registry-entry missing?

0
Independent Software Vendors: 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!

 
LVL 1

Expert Comment

by:csalves
ID: 1497437
Hello,

You have to check if your Excel apps is correctly registered.

If it is you have to create an variable of object type and start your object as an excel apps. What i wont to mean is:
Use the CreateObject Function or GetObject if you're already running your excel apps.

regards,

0
 
LVL 1

Expert Comment

by:csalves
ID: 1497438
I'm sorry bogie2...
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1497439
Try this and see if it works ok
    Dim dbe As New DBEngine
    dbe.OpenConnection "apekool.mdb"

0
 
LVL 5

Expert Comment

by:vboukhar
ID: 1497440
Maybe must be something like that:
    Dim wrkJet As Workspace
    Dim dbsMy As Database
    Set wrkJet = DBEngine.CreateWorkspace("special", "admin", "")
    Set dbsMy = wrkJet.OpenDatabase("d:\dict.mdb")
in ObjectBrowser I not found OpenConnection for DBEngine at all.
0
 
LVL 3

Expert Comment

by:fguerreiro_inix
ID: 1497441
Hello Bogie2

At first, if you want to create an Access 7.0 Database, you must use DBEngine.CreateDatabase to create an MDB file. If you use OpenConnection it only is going to work with ODBC Databases(Opens a Connection object on an ODBC data source - ODBCDirect workspaces only).

Look at this:

This example uses CreateDatabase to create a new, encrypted Database object.

Sub CreateDatabaseX()

   Dim wrkDefault As Workspace
   Dim dbsNew As DATABASE
   Dim prpLoop As Property

   ' Get default Workspace.
   Set wrkDefault = DBEngine.Workspaces(0)
   
' Make sure there isn't already a file with the name of
' the new database.

  If Dir("NewDB.mdb") <> "" Then Kill "NewDB.mdb"
     ' Create a new database
     Set dbsNew = wrkDefault.CreateDatabase("NewDB.mdb", _
            dbLangGeneral, dbEncrypt)
  endif
End Sub

You don't need to instatiate DBEngine.
DBEngine has a default workspace alredy created DBEngine.Workspaces(0).

Hope this helps
Regards

0
 

Author Comment

by:bogie2
ID: 1497442
Thanks for all your comments. However, I still face the same old problem.
Any reference to the DBEngine object (which should exist by default) is
flagged "Error 424 - Object required". The scripts used to work fine before,
by they stopped working when I reinstalled Windows. What could it be?
I also tried reinstalling Excel, but it does not help, unfortunately.
Any ideas?
0
 
LVL 5

Expert Comment

by:vboukhar
ID: 1497443
What about my comment?
0
 
LVL 3

Expert Comment

by:fguerreiro_inix
ID: 1497444
What's DAO version are you using?
0
 
LVL 3

Accepted Solution

by:
fguerreiro_inix earned 1200 total points
ID: 1497445
Your registry must be a great confusion.

You have a problem in the registry with DAO.


Run RegClean, Unistall Access, Run RegClean, Install Access,Run RegClean again.
See it work

Regards
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month20 days, 10 hours left to enroll

868 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