PDA

Click to See Complete Forum and Search --> : Integrating an Access Report into VB


steven_lee_100
Nov 15th, 1999, 04:15 PM
Can anyone tell me how easy (or difficult) it is to integrate an Access97 report into a VB6 app. If it is easy, a simple explanation of how to do it would be greatly appreciated.

Thanx in advance

Steve

Clunietp
Nov 16th, 1999, 11:53 AM
It's not too bad with a little automation:

User must have Access installed on system -- Add a reference to the Access Object Library.


Dim axs As New Access.Application

axs.OpenCurrentDatabase ("c:\data\path\here.mdb")
axs.DoCmd.OpenReport "ReportNameHere", acViewNormal
axs.CloseCurrentDatabase

Set axs = Nothing

This will print the report -- but as far as complete integration with your app (without MS Access) I do not believe that you can access the report like you can with a table or query.

HTH

Tom

Clunietp
Nov 18th, 1999, 12:27 AM
check out the second and third parameters of the DoCmd function, you can specify a filter and/or a where condition. Otherwise, you can access the report via the axs.reports collection and manipulate report properties there (like set the SQL statement of the recordsource before you print it). I didn't try it myself, let me know if you have problems.

Tom

steven_lee_100
Nov 18th, 1999, 11:43 AM
Thanks Tom, that works great. Any idea about how to give my a report a parameter from VB. Any info will be greatly appreciated.