Report Preview through VB6

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top