0

Hi,
i have designed reports with access.I need code to call them in vb so that i can print them via an application am developing.Anyone know how to do so?Thanx

2
Contributors
1
Reply
3
Views
9 Years
Discussion Span
Last Post by Naseem89
0

Hi, you can through this code to be printed report from the file Access:

'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
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.