>Use object automation. It will do the trick for you and you will find
>that you can do a lot more that just printing reports.
>Project/References: add "Microsoft Access 8.0 Object library",
>and you can do everything you wants to and more....
>Press F2 after you have selected Microsoft access 8.0 Object lib. and
>you will get the object browser...
>You might find articles about the subject in VB Programmers Journal..
>Bjoern Ivar Katla
>>How can I print a Report created in Access 97 from within VB program (NOT
>>from Access program).
>>From my VB application I am accessing an Access 97 database that contains:
>>Tables, Queries and Reports. I can access the Tables and Queries using
>>OpenRecordset method, but for Reports I have No clue how to do so.
>>Any help will be highly appreciated.
>>Could you please send me a copy (Cc:) of your answer to my email address:
This from Auto97.exe (no idea where I found it on MS's site):
Previewing or Printing a Microsoft Access Report
The following code uses Automation to preview or print a report in the
Northwind database. This procedure requires a reference to the Microsoft
Access 8.0 object library in order to run. To reference this object
library, click References from the Tools menu in a module and check the
Microsoft 8.0 object library.
Sub PrintAccessReport(dbName As String, rptName As String, _
Preview As Boolean)
'Previews or Prints the specified report in the specified database.
'Once the report has printed, or once the preview window is closed,
'the instance is terminated.
'PrintAccessReport "C:\Northwind.mdb", "Sales by Category", True
'This procedure requires the Microsoft Access 8.0 object library be
'referenced under Tools, References in your module.
Dim objAccess As Access.Application
On Error GoTo PrintAccessReport_ErrHandler
Set objAccess = CreateObject("Access.Application")
If Preview Then 'preview report on screen
.Visible = True
.DoCmd.OpenReport reportname:=rptName, View:=acViewPreview
Else 'print report to printer
.DoCmd.OpenReport reportname:=rptName, View:=acNormal
DoEvents 'allow report to be sent to printer
Set objAccess = Nothing
MsgBox Error$(), , "Print Access Report"