Preview and print report problems

  • Thread starter dinadvani via AccessMonster.com
  • Start date
D

dinadvani via AccessMonster.com

Hi All,

I am faing issues with command button, I have a small window that pops up
when view reports option is selected from swicthboard.
Now in view report I have 5 different reports, I wld like to create 1 single
"Preview", "Print" and "Mail Report" command buttons for all the 5 reports.
for that i have put all the five reports in option group.

But with the below code only cancel button only works

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

Sub PrintReports(PrintMode As Integer)

On Error GoTo Err_Preview_Click
' This procedure used in Preview_Click and Print_Click Sub procedures.
' Preview or print report selected in the ReportToPrint option group.
' Then close the Print Sales Reports Dialog form.

'Dim strWhereCategory As String

'strWhereCategory = "CategoryName = Forms![View Reports]!SelectCategory"
DoCmd.OpenForm "Reporting view"
Select Case Me!ReportstoPrint
Case 1
DoCmd.OpenReport "List of Accounts", PrintMode
Case 2
DoCmd.OpenReport "Quarter-wise Report", PrintMode
Case 3
DoCmd.OpenReport "Accountwise Fee Report", PrintMode
Case 4
DoCmd.OpenReport "Difference in Projected and Actual Report",
PrintMode
End Select
DoCmd.Close acForm, "Reporting view"

Exit_Preview_Click:
Exit Sub

Err_Preview_Click:
Resume Exit_Preview_Click

End Sub

Private Sub Cancel_Click()

' This code created by Command Button Wizard.
On Error GoTo Err_Cancel_Click

' Close form.
DoCmd.Close

Exit_Cancel_Click:
Exit Sub

Err_Cancel_Click:
MsgBox Err.Description
Resume Exit_Cancel_Click


End Sub

Private Sub Preview_Click()
PrintReports acPreview
End Sub

Private Sub Print_Click()
PrintReports acNormal
End Sub
 
D

dinadvani via AccessMonster.com

Please IGNORE, I found a way
Hi All,

I am faing issues with command button, I have a small window that pops up
when view reports option is selected from swicthboard.
Now in view report I have 5 different reports, I wld like to create 1 single
"Preview", "Print" and "Mail Report" command buttons for all the 5 reports.
for that i have put all the five reports in option group.

But with the below code only cancel button only works

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

Sub PrintReports(PrintMode As Integer)

On Error GoTo Err_Preview_Click
' This procedure used in Preview_Click and Print_Click Sub procedures.
' Preview or print report selected in the ReportToPrint option group.
' Then close the Print Sales Reports Dialog form.

'Dim strWhereCategory As String

'strWhereCategory = "CategoryName = Forms![View Reports]!SelectCategory"
DoCmd.OpenForm "Reporting view"
Select Case Me!ReportstoPrint
Case 1
DoCmd.OpenReport "List of Accounts", PrintMode
Case 2
DoCmd.OpenReport "Quarter-wise Report", PrintMode
Case 3
DoCmd.OpenReport "Accountwise Fee Report", PrintMode
Case 4
DoCmd.OpenReport "Difference in Projected and Actual Report",
PrintMode
End Select
DoCmd.Close acForm, "Reporting view"

Exit_Preview_Click:
Exit Sub

Err_Preview_Click:
Resume Exit_Preview_Click

End Sub

Private Sub Cancel_Click()

' This code created by Command Button Wizard.
On Error GoTo Err_Cancel_Click

' Close form.
DoCmd.Close

Exit_Cancel_Click:
Exit Sub

Err_Cancel_Click:
MsgBox Err.Description
Resume Exit_Cancel_Click

End Sub

Private Sub Preview_Click()
PrintReports acPreview
End Sub

Private Sub Print_Click()
PrintReports acNormal
End Sub
 

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