Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: CrAz3D on April 03, 2004, 04:19 PM

Title: OpenDatabase()-AcitveX can't create object
Post by: CrAz3D on April 03, 2004, 04:19 PM
I keep receiving the error "ActiveX can't create object

I know that the path is correct & that Ham.mdb does, in fact, exsist.  Any ideas?
Global TresDB as Object
Set TresDB = OpenDatabase("C:\Documents and Settings\Owner\Desktop\Ham.mdb")
Title: Re:OpenDatabase()-AcitveX can't create object
Post by: Adron on April 04, 2004, 04:52 PM
Perhaps your database drivers aren't correctly registered? Which one is it you're trying to use?
Title: Re:OpenDatabase()-AcitveX can't create object
Post by: CrAz3D on April 04, 2004, 10:38 PM
Hmm.  I'm just trying to open Ham.MDB, a regular Access database located on my desktop.

Something that COULD be confliciting also, I "do not have a license" to use a data enviroment in ANY project on my computer.  I've reinstalled VB twice now & I am thinking that solving this could solve the OpenDatabase error, or @ least bring me closer.
Title: Re:OpenDatabase()-AcitveX can't create object
Post by: Adron on April 05, 2004, 03:51 AM
Quote from: CrAz3D on April 04, 2004, 10:38 PM
Something that COULD be confliciting also, I "do not have a license" to use a data enviroment in ANY project on my computer.  I've reinstalled VB twice now & I am thinking that solving this could solve the OpenDatabase error, or @ least bring me closer.

Do you have VB Pro? IIRC, in some VB versions, opening a database without any gui object attached to it was restricted to the Pro version.

I'm still wondering where your OpenDatabase function is coming from, go check that?
Title: Re:OpenDatabase()-AcitveX can't create object
Post by: CrAz3D on April 05, 2004, 07:24 PM
This is just code I am editting from the previous person that worked on it.  It is a fundraiser database for my school band, I'm not sure where they got the OpenDatabase Function.


Licensing issue fixed.

OpenDatabase is prob now.
Title: Re:OpenDatabase()-AcitveX can't create object
Post by: Grok on April 05, 2004, 08:19 PM
Quote from: CrAz3D on April 05, 2004, 07:24 PM
Licensing issue fixed.

OpenDatabase is prob now.

What does this mean?  You didn't answer Adron's valid questions.  What edition of VB is this?  Pro?  Enterprise?  Warez or legit?

What are the listed references in the menu Project|References?

It's quite possible your scope includes multiple OpenDatabase functions, or at least the wrong one than you are expecting.  Which technology are you expecting OpenDatabase to come from?  DAO?  3.5? 4.0? 4.5?  Depending on your answer, is the proper typelib selected in references?

If you want help you have to give the helpers more than enough information.  Try to guess what we would need to solve the problem, then give that and more!
Title: Re:OpenDatabase()-AcitveX can't create object
Post by: Grok on April 05, 2004, 08:34 PM

   Dim sDB As String
   Dim wrkJet As Workspace
   Dim TresDB As Object
   
   ' Create Microsoft Jet Workspace object.
   Set wrkJet = CreateWorkspace("", "admin", "", dbUseJet)
   
   sDB = "D:\VS6\VB98\NWIND.MDB"
   Set TresDB = wrkJet.OpenDatabase(sDB, True)


works fine here with Microsoft DAO 3.6 referenced.
Title: Re:OpenDatabase()-AcitveX can't create object
Post by: CrAz3D on April 06, 2004, 06:19 PM
Quote from: Grok on April 05, 2004, 08:19 PM
Quote from: CrAz3D on April 05, 2004, 07:24 PM
Licensing issue fixed.

OpenDatabase is prob now.

What does this mean?  You didn't answer Adron's valid questions.  What edition of VB is this?  Pro?  Enterprise?  Warez or legit?

What are the listed references in the menu Project|References?

It's quite possible your scope includes multiple OpenDatabase functions, or at least the wrong one than you are expecting.  Which technology are you expecting OpenDatabase to come from?  DAO?  3.5? 4.0? 4.5?  Depending on your answer, is the proper typelib selected in references?

If you want help you have to give the helpers more than enough information.  Try to guess what we would need to solve the problem, then give that and more!

My ignorance.  Visual Basic 6.0 Professional Ed, from Hastings w/a student discount.

I'll try using the wrkJet method you listed above, thank you
Title: Re:OpenDatabase()-AcitveX can't create object
Post by: CrAz3D on April 11, 2004, 01:21 AM
Grok, in your code, what is the Workspace?
Is it the data enviroment?
Title: Re:OpenDatabase()-AcitveX can't create object
Post by: Adron on April 11, 2004, 05:50 AM
A Workspace is one of the DAO classes. IIRC it represents a session to DAO, in which you can have open databases/connections. Transactions are local to a workspace. I also think you can have different usernames active in different workspaces.