Make your own free website on Tripod.com
Print MS Access Report

Preparations

Add 1 Command Button to your form.
Add 1 reference to Microsoft Access X.0 Object Library (From
VB Menu choose Project -> References..., mark the Microsoft Access X.0 Object Library check box and press OK).

Form Code

Private Sub Command1_Click()
    Dim ac As Access.Application
    Set ac = New Access.Application
    ' open the database.
    ' replace the "c:\myDir\myDBFileName.mdb" below with your
    ' database file name
    ac.OpenCurrentDatabase ("c:\myDir\myDBFileName.mdb")
    ' uncomment the line below if you want to see Print Preview
    ' ac.Visible = True
    ' replace the acViewNormal below with acViewPreview
    ' if you want to see Print Preview
    ac.DoCmd.OpenReport "Catalog", acViewNormal
    ' delete the line below if you want to see Print Preview
    ac.CloseCurrentDatabase
End Sub

Go Back