• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 176
  • Last Modified:

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
0
baileys
Asked:
baileys
  • 3
  • 2
1 Solution
 
baileysAuthor Commented:
The report needs to be preview before printing.

Sheila
0
 
AxterCommented:
Use the following command:

DoCmd.OpenReport "MyReportName", acNormal
0
 
johnny6Commented:
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.Application")
appAccess.OpenCurrentDatabase (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
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
baileysAuthor Commented:
Johnny6 please respond.  Your answer is what I wanted.  Thanks
0
 
johnny6Commented:
Sheila,
Thank you for the points.  Hoping for a good grade.  :)


John
0
 
baileysAuthor Commented:
Thanks again for your help!!
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now