Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print Preview A Report In Another Database

Status
Not open for further replies.

rcorbett

Instructor
Nov 25, 2002
24
US
Have a form that is used to access reports that are located in several databases. Below is the code for one control on the form - it is set to print. I want to have it go to print preview instead. Well according to my research all I need to do is change acViewNormal to acViewPreview which I have tried but it doesn't come up at all. Does anyone have any suggestions? Thanks.

Private Sub Command0_Click()

Dim appAccess As New Access.Application

appAccess.OpenCurrentDatabase "\\Nts02\Vax Files\Donor Master & History.mdb"
appAccess.DoCmd.OpenReport "Donor Inquiry by BBCS #", acViewNormal
appAccess.CloseCurrentDatabase
appAccess.Quit
Set appAccess = Nothing
End Sub
 
This should do it for you:

appAccess.OpenCurrentDatabase "\\Nts02\Vax Files\Donor Master & History.mdb"
appAccess.Visible = True
appAccess.DoCmd.OpenReport "Donor Inquiry by BBCS #", acViewPreview

Bill
 
Thanks Bill - it definitely makes the db visible, but the report just prints and doesn't let me view it first.
 
Hi rcorbett,

This is my full code:

Dim appAccess As New Access.Application
appAccess.OpenCurrentDatabase "\\Nts02\Vax Files\Donor Master & History.mdb"
appAccess.Visible = True
appAccess.DoCmd.RunCommand acCmdAppMaximize
appAccess.DoCmd.OpenReport "Donor Inquiry by BBCS #", acViewPreview
appAccess.DoCmd.Maximize
Set appAccess = Nothing

You can delete references to Maximize if not needed. Also, if Print Previewing. You don't need:

appAccess.CloseCurrentDatabase
appAccess.Quit

The DB should close when the user closes the Report.

Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top