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

Command button code- print or preview a report 1

Status
Not open for further replies.

Fredgarner

Technical User
Jul 21, 2005
29
GB
Does anyone know why this code is making my reports print rather than preview? It is choosing from 3 reports, which are selected by option buttons.

Option Compare Database ' Use database order for string comparisons.
Option Explicit ' Requires variables to be declared before they are used.


Private Sub Detail_Click()

End Sub
Private Sub Command56_Click()
On Error GoTo Err_Command56_Click

Dim lcReportName As String

Select Case Me!Reports
Case 1
DoCmd.OpenReport "Current holdings (by intermediary)"
Case 2
DoCmd.OpenReport "Current holdings (by share class)"
Case 3
DoCmd.OpenReport "Current holdings (by shareholder)"
End Select
DoCmd.OpenReport lcReportName, acPreview

Exit_Command56_Click:
Exit Sub

Err_Command56_Click:
MsgBox Err.Description
Resume Exit_Command56_Click

End Sub
 
Select Case Me!Reports
Case 1
lcReportName = "Current holdings (by intermediary)"
Case 2
lcReportName = "Current holdings (by share class)"
Case 3
lcReportName = "Current holdings (by shareholder)"
End Select
DoCmd.OpenReport lcReportName, acViewPreview

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top