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
baileysAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
baileysAuthor Commented:
Thanks again for your help!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.