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!

Runtime MS Access - Running reports from VB6 1

Status
Not open for further replies.

HaworthBantam

Programmer
Jan 31, 2002
132
GB

The organisation I work for has rolled out XP in place of it's existing NT platform.

As part of the "build" users have been given MS Access 2003 Runtime only (version 11.0.5614.0). Previously all users had the full version of MS Access 97 as standard.

As a consequence we've had to amend/rewrite a lot of our apps, but one is causing me a few more headaches than usual.

The application in question is written using VB6, connected to a back end Access database. Having not been provided with Crystal Reports, I've used a second Access database that contains reports, and these are called from within the VB6 application.

Code example:

Public Sub ByCustomerName()

On Error GoTo ByCustomerNameError

'Create an instance of Access.
Set acMyApp = New Access.Application

'Set Access as active window.
acMyApp.Visible = True

'Open the Access database.
acMyApp.OpenCurrentDatabase "[pathway]\Reports.mdb", False

'Run the CustomerName() procedure within the Reports.mdb database.
acMyApp.Run "CustomerName"

Exit Sub

ByCustomerNameError:

Select Case Err.Number
Case -2147352567 'Error because user clicked cancel when entering parameter.
Set acMyApp = Nothing
Exit Sub
Case Else
MsgBox "An Error has occured, please quote the following to the IT Service Centre - tel **** *** ****." _
& Chr(13) & Chr(13) & Err.Number & " - " & Err.Description, vbOKOnly, _
"Error in procedure - ByCustomerName (BDApp ID: 5050)"
Resume Next
End Select

End Sub

My problem, basically, is that now the users only have the runtime version of Access, the reports functionality within the app no longer works.

Is there anyone out there with a solution idea not involving Crystal Reports or a move to dot net, neither of which my employer will pay for.

Many Thanks.

Ian
 
What was the old version of Access? It could be that the new version is incompatable with the old version.


Andy
 
The Reports.mdb is an Access 97 database, but the problem still remains the same if I convert it to Access 2003.

The easiest solution would be to give all users the full version of Access 2003, as I know the code works fine in this scenario. However, the policy within this organisation is not to give the full version as it doesn't want to pay the associated licence costs, or have people "dabbling".

Ian
 

Ian,

I think that
Code:
Dim acMyApp As Access.Application
Set acMyApp = New Access.Application
equals
Code:
Dim acMyApp As Object
Set acMyApp = CreateObject("Access.Application")

and with run-time version you cannt create a new database

But if there are just few reports, you could create macros in the extra mdb, that shall open (+print? ) those reports and quit. Then in VB6 create on the fly a shortcut that runs that macro (check out Startup command-line options) and use the FollowHyperlink to run the shortcut. Or just give them rights to play with the reports in the reports-mdb!

 
Thanks JerryKlmns,

You've given me a couple of ideas that I can have a "play" with.

Have a star.

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top