CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2001
    Location
    Lancashire, England
    Posts
    16

    Error running access report from VB6

    I have been calling an Access 97 report from within VB 6 as a reporting tool. This works fine on my pc and most others.

    However, a pc on which it worked fine has just upgraded to Office Pro 2000, and now when I click the report button to launch the Access report, I get the error Can't launch Access module, and is caused by the line in code:

    Set mobjAccess = New Access.Application

    where mobjAccess is dimensioned as an Object and the reference to MS Access 8.0 Object Library is included in the project.

    I've checked the pc and it still has the MSACC8.OLB file installed, but also has an MSACC9.OLB file as well. I've tried re-registering the V8 object to no avail.

    Any ideas?

    Many thanks in advance.

    dave Seddon


  2. #2
    Join Date
    May 2001
    Location
    Russia
    Posts
    200

    Re: Error running access report from VB6

    Don't use Reference to MS Access Object Library

    Use CreateObject function:

    Dim mobjAccess as Object
    Set mobjAccess = CreateObject("Access.Application")


    Verefy this code.

    Andy Tower

  3. #3
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Error running access report from VB6

    You can specify a version using CreateObject, this way, you can force him to use the 97 version

    set mocjAccess = CreateObject("Access.Application.8")



    The .8 at the end specifies you want to use version 8 of Access, which is Access 97

    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured