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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print/Preview Buttons

Status
Not open for further replies.

Garridon

Programmer
Mar 2, 2000
718
US
I use an option group with a Print button and a Preview button to allow the user to select the different reports and whether they want to print it or just preview it. The code looks like this:

Private Sub cmdPreview_Click()
On Error GoTo ErrorPreview

Select Case [fraPrint]

Case Is = 1
DoCmd.OpenReport "rptOpen", acViewPreview

Case Is = 2
DoCmd.OpenReport "rptOverdue", acViewPreview

Case Is = 3
DoCmd.OpenReport "rptTrend", acViewPreview

Case Is = 4
DoCmd.OpenReport "rptClosed", acViewPreview

Case Else
MsgBox "Please chose a report to view", vbExclamation, _
"Suspenses"

End Select

ExitPreview:
Exit Sub

ErrorPreview:

Select Case Err.Number

Case 2501
Resume ExitPreview

Case 2603
MsgBox "You do not have access to this department's suspenses", _
vbExclamation, "Access Denied"

Case Else
MsgBox Err.Description
Resume ExitPreview

End Select

End Sub

The code for the print button is the same except for the acViewPreview is acViewNormal.

If I click on the Preview button to look at a report, then click on the Print button (the one on the form) while the report is still open, the report changes to design view and prints. Does anyone know why it's opening in design view and how to keep it from doing it? [ponder]

Thanks!

Linda Adams
Linda Adams/Emory Hackman Official Web site Official web site for actor David Hedison:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top