Access Reports
Is it possible to use VBA code to open and run a Microsoft Access Report?
In other words a VB front end that would permit a user to select a report that was saved in an ACCESS MDB.
Web Development
Is it possible to use VBA code to open and run a Microsoft Access Report?
In other words a VB front end that would permit a user to select a report that was saved in an ACCESS MDB.
by roc180
Lets say you have a button on your form, with in the On_Click event of your button use the following code:
DoCmd.Openreport "ReportName",acViewNormal 'Print report
If you want to just open the report: DoCmd.Openreport "ReportName",acViewPreview
If you want some example code that will read all your reports into a combo box and allow your users to select one and then view it, let me know and I can E-mail it to you.
Good Luck
Neal Martinelli
by roc180
by fbarr_taz
by vinnyd
Yes it is possible. In VB you must include the Microsoft Access Object as part of the project (under Project References).
The following code sample opens an access database and runs the report from the access database from a command button.
This example prints the report to the default printer when it is run.
Private Sub Command1_Click()
Dim appAccess As New Access.Application
Const conPath As String = "C:\outlook\db1.mdb"
With appAccess
' Open the Outlook database.
.OpenCurrentDatabase conPath
' Open the Find duplicates report.
.DoCmd.OpenReport "Find duplicates for tblContacts"
End With
End Sub
by fbarr_taz
by fbarr_taz
This discussion is closed to new replies.
Sort by Trending