Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Active X cant create object difficulties

Status
Not open for further replies.

Skyusa11

Programmer
Jun 26, 2001
4
0
0
US
Have VB programs written originally in V5. Using Windows NT, and VB 6.0, when running 'Make program.exe' I get 'ActiveX component cannot create object' on a line that says 'set db = OpenDatabase ("databasename.mdb")'. I'm lost.
 
Look for missing project references, namely Microsoft DAO Object Libraries.

Mark
 
In Projects/references I have Microsoft DAO 3.6 Object library marked, and the DAO360.dll is where it is supposed to be. I did have to copy it from another machine. I tried to run regsvr32 against it (regsvr32.exe dao360.dll) but got 'Load Library (dao360.dll) failed, GetLastError returns 0x0000007e'. I know I am not the sharpest tack in the pile but this is frustrating.
 
I read something about that error on Windows NT, recently. Check out Microsoft.com's MSND search engine for now. My book is at home and I'm at work. If I remember, I'll post the info later.
Good Luck,
 
Skyusa11,

I know with my work in VB6, the opendatabase function from VB past no longer works. The new data access objects they are using don't use opendatabase anymore. So as frustrating as it may be, you may need to re-write parts of your code. I tried doing the same thing (updating VB5 to VB6) but the OpenDatabase would not work. I had to re-write those parts of the code to utilize the new data access.

Hope that helps a bit.

-crater
 
I use the OpenDatabase() method in Visual Basic 6 all the time. I don't think that is the problem.
 
I am currently looking at the different data access code for VB6 as a result of SmokingCrater's post and found some on another site using syntax "Data1.DatabaseName = ("database.mdb"). I have placed it in one of my programs and the compiler at least got through that without choking. I will work it into the other code and see what happens at run time.
 
Skyusa11,

That's is what I am talking about. The VB6 (at least the version I have at home where I have worked with the Database connectivity and such) uses a DataEnvironment (which in your instance is called Data1) to connect rather than the OpenDatabase function.

Ah, here we go. Consulting my Help files that are found in my VB6, I find that OpenDatabase corresponds to DAO 3.51. You are now using 3.6. Also found in my help manuals:

------------------------

Obsolete Features in DAO


Microsoft Access versions 1.x and 2.0 and Microsoft Visual Basic version 3.0 used earlier versions of DAO. Several objects, methods, properties, and statements in those earlier versions are considered "obsolete" but are still supported for backwards compatibility with existing user code.

The following is a list of DAO methods, properties, objects, and statements that have been replaced by more powerful, flexible, and easy-to-use features. Each obsolete feature in the list has a corresponding replacement feature.

...
OpenDatabase statement
...

-----------------------------

Therefore, the OpenDatabase may be still implemented in some versions for backwards compatabillity, but that's about it.

So since you are using the DAO 3.6, I'm afraid you are going to have to implement via DataEnvironment objects instead of by OpenDatabase.

Hope that helps a little more.

-crater
 
Sorry SmokingCrater, you are correct. I was installing Visual Basic 6 Ent again last night and it gave me the option of going with the new db engine, or using the old one that is compatible with VB5. I forgot about that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top