
Originally Posted by
seema_s
What is the code to call a report from VB? I need help plz.
First, go into Access and create the report.
Then, from your VB program, set a reference to the MS Access Object Library, then run something like this
VB Code:
Private Sub cmdPrintReport_Click()
Dim Axs As Access.Application
Set Axs = CreateObject("Access.Application")
Axs.OpenCurrentDatabase (DBPath)
Axs.DoCmd.OpenReport "MyReport"
Set Axs = Nothing
Axs.Quit
End Sub
Where MyReport is the name of your Access report and DBPath is the full path and db name of your database.