Click to See Complete Forum and Search --> : Error running access report from VB6


dave seddon
July 3rd, 2001, 09:00 AM
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

Tower
July 5th, 2001, 10:12 PM
Don't use Reference to MS Access Object Library

Use CreateObject function:

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


Verefy this code.

Cakkie
July 6th, 2001, 05:41 AM
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
slisse@planetinternet.be

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