dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Thread: Active X component can't create object

  1. #1
    Join Date
    Jun 2002
    Posts
    43

    Active X component can't create object

    I am getting runtime error 429 "Active X component can't create object". The debugger indicates that the error is occurring on this code:
    Set maindatabase = DBEngine.OpenDatabase(sPath, False, False, ";pwd=*******")

    Below, I found some information on the web, but still do not know how to fix this. I really, really need help. It was working fine twenty minutes ago.
    S
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    So all that old spaghetti code stuff is dead, right? Wrong! All four of these beasts—GoTo, GoSub, line numbers, and Returns—are still alive in VB6. Don't believe it? Copy and paste the code from Listing 1 into a button click handler in a VB6 application and try it!

    Listing 1: VB Spaghetti Code
    10 GoSub 30
    15 MsgBox "2"
    20 GoTo 50
    30 MsgBox "1"
    40 Return
    50 End
    It's a sad fact, but I ran into legacy code as part of a project in 2000 that made extensive use of GoSub and Return! GoSub and Return have finally been dropped in Visual Basic .NET, but line numbers are still around and kicking in VB (although they are automatically converted to labels in VB .NET.)

    I'll be the last one to shed tears over the passing of GoSub and Return, but this article demonstrates a good use for line numbers and an accompanying function—Erl—that has been in VB (but has been undocumented) all along. By the way, Erl is still in VB .NET as of Beta 2 as a (still poorly documented) property of the Err object.

    A Debugging Headache
    A common problem when debugging VB components is unhelpful error messages. A classic example is "Runtime error 429: ActiveX component can't create object" being raised from a component's Class_Initialize method, which itself instantiates several other components (see Listing 2). This error is difficult to track down because the error could be coming from any of the Set statements—and, indeed, may well be originating from a lower-level dependency that you don't even know about.

    (If you want to read the whole article:
    http://www.informit.com/isapi/produc...tent/index.asp)

  2. #2
    Join Date
    Sep 2001
    Location
    IL, USA
    Posts
    1,090
    If you are opening an Access database then change ";pwd=*******" to
    "MS Access;pwd=*******"
    if you're opening a different database type then replace MS Access with the appropriate specifier. For example if you are using Microsoft Excel 97 then the specifier will be Excel 8.0

  3. #3
    Join Date
    Jun 2002
    Posts
    43

    Unhappy

    Set maindatabase = DBEngine.OpenDatabase(sPath, False, False, "MS Access;pwd=*******")

    Error message remains the same....????

    S

  4. #4
    Join Date
    Sep 2001
    Location
    IL, USA
    Posts
    1,090
    What are you're project references? How you dimension maindatabase?

  5. #5
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167
    how about try to open the db with the workspace object?
    Code:
    'sample from MSDN
    
        Dim wrkJet As Workspace
        Dim dbsNorthwind As Database
        Dim dbsPubs As Database
        Dim dbsPubs2 As Database
        Dim dbsLoop As Database
        Dim prpLoop As Property
    
        ' Create Microsoft Jet Workspace object.
        Set wrkJet = CreateWorkspace("", "admin", "", dbUseJet)
    
        ' Open Database object from saved Microsoft Jet database 
        ' for exclusive use.
        MsgBox "Opening Northwind..."
        Set dbsNorthwind = wrkJet.OpenDatabase("Northwind.mdb", _
            True)
    Good Luck,
    -Cool Bizs

  6. #6
    Join Date
    Jun 2002
    Posts
    43
    Hi,
    Global maindatabase As Database

    Pretty sure a reference has been removed that should be there. The ones referenced are:
    Visual Basic For Application
    Visual Basic Runtime Objects and Procedures
    Visual Basic Object's and Procedures
    Microsoft DAO 3.6 Object Library
    Microsoft Data Binding Collection
    Microsoft ActiveX Data Object 2.0 Library
    ODBC Driver & Data Source Name Functions
    Microsoft Access 9.0 Object Library
    Microsoft Data Report Designer v6.0
    Microsoft data Formatting Object Library
    Data Object Wizard
    Last edited by SoniaE; July 18th, 2002 at 02:48 PM.

  7. #7
    Join Date
    Sep 2001
    Location
    IL, USA
    Posts
    1,090
    Did you check if any of the checked Components has Missing next to it?

  8. #8
    Join Date
    Jun 2002
    Posts
    43
    They are all there. None mising......
    Incidentally, opening the database with the workspace object just generates the same error.



    ...????????????
    Last edited by SoniaE; July 19th, 2002 at 06:54 AM.

  9. #9
    Join Date
    Jun 2002
    Posts
    43
    I thought I would let you know that to solve this problem I had to register dao360.dll - the DAO 3.6 Object Library - in the registry. Thanks for your input
    S.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)