baileys
asked on
Printing an Access Report from VB
How do you print an Access Report from VB. I need detailed instructions!! This is urgent, the project I am working on is due in two weeks.
Sheila
Sheila
Use the following command:
DoCmd.OpenReport "MyReportName", acNormal
DoCmd.OpenReport "MyReportName", acNormal
Sheila:
I think this is what you are looking for:
' ************************** ********** ********** ********** ********** ****
' * Comments : Use OLE automation to print Access reports
' *
' *
' ************************** ********** ********** ********** ********** ****
Sub PrintReport(ByVal DBPath As String, ByVal ReportName As String, Optional OpenMode As Integer, Optional Filter As String, Optional Criteria As String)
' #VBIDEUtils#************** ********** ********** ********** ********** ******
' * Programmer Name : Waty Thierry
' * Web Site : www.geocities.com/ResearchTriangle/6311/
' * E-Mail : waty.thierry@usa.net
' * Date : 9/10/98
' * Time : 15:00
' * Module Name : Report_Module
' * Module Filename :
' * Procedure Name : PrintReport
' * Parameters :
' * ByVal DBPath As String
' * ByVal ReportName As String
' * Optional OpenMode As Integer
' * Optional Filter As String
' * Optional Criteria As String
' ************************** ********** ********** ********** ********** ****
' * Comments : Use OLE automation to print Access reports
' *
' *
' ************************** ********** ********** ********** ********** ****
Dim appAccess As Object
Set appAccess = CreateObject("Access.Appli cation")
appAccess.OpenCurrentDatab ase (DBPath)
'************************* ********** ********** ********** *
'Access constants for OpenMode are
'acNormal - Print (default)
'acPreview - Print Preview
'acDesign - Design Edit Mode
'************************* ********** ********** ********** *
appAccess.DoCmd.OpenReport ReportName, OpenMode, Filter, Criteria
'************************* ********** ********** ********** *
'if open mode is Preview then don't quit Access this can
'also be deleted if you do not want Access to quit after
'printing a report
'************************* ********** ********** ********** *
'If OpenMode <> acPreview Then
' appAccess.Quit
'End If
Set appAccess = Nothing
End Sub
John
I think this is what you are looking for:
' **************************
' * Comments : Use OLE automation to print Access reports
' *
' *
' **************************
Sub PrintReport(ByVal DBPath As String, ByVal ReportName As String, Optional OpenMode As Integer, Optional Filter As String, Optional Criteria As String)
' #VBIDEUtils#**************
' * Programmer Name : Waty Thierry
' * Web Site : www.geocities.com/ResearchTriangle/6311/
' * E-Mail : waty.thierry@usa.net
' * Date : 9/10/98
' * Time : 15:00
' * Module Name : Report_Module
' * Module Filename :
' * Procedure Name : PrintReport
' * Parameters :
' * ByVal DBPath As String
' * ByVal ReportName As String
' * Optional OpenMode As Integer
' * Optional Filter As String
' * Optional Criteria As String
' **************************
' * Comments : Use OLE automation to print Access reports
' *
' *
' **************************
Dim appAccess As Object
Set appAccess = CreateObject("Access.Appli
appAccess.OpenCurrentDatab
'*************************
'Access constants for OpenMode are
'acNormal - Print (default)
'acPreview - Print Preview
'acDesign - Design Edit Mode
'*************************
appAccess.DoCmd.OpenReport
'*************************
'if open mode is Preview then don't quit Access this can
'also be deleted if you do not want Access to quit after
'printing a report
'*************************
'If OpenMode <> acPreview Then
' appAccess.Quit
'End If
Set appAccess = Nothing
End Sub
John
ASKER
Johnny6 please respond. Your answer is what I wanted. Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks again for your help!!
ASKER
Sheila