Solved

DBEngine object not found in Excel

Posted on 1998-11-04
12
716 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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 600 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

929 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now