Report Preview through VB6

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

DoCmd.OpenReport "MyReport", acPreview
does not give the report preview when executed through VB6.

However acNormal prints the reports to the printer.

How to obtain the report-preview through VB?
 
Something like...

Code
-------------------

Dim objAccess As Object
Dim strDbName, strReportName As String
strDbName = "C:\MyDocuments\Your.mdb" change this to your database
strReportName = "YourReport" change this to your report

Set objAccess = GetObject(strDbName, "Access.Application")

With objAccess
' Make Access visible and Preview report on screen
.Visible = True
.DoCmd.OpenReport strReportName, acViewPreview, ""
.DoCmd.Maximize
' Show Print Preview Toolbar
.DoCmd.ShowToolbar "Database", acToolbarYes
.DoCmd.ShowToolbar "Print Preview", acToolbarYes
End With
 
Back
Top