D
dinadvani via AccessMonster.com
Hi,
I want to create a form where I will put in all the report names and then
preview or print or mail report based on the selection.
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![Sales Reports Dialog]!
SelectCategory"
Select Case Me!ReportToPrint
Case 1
DoCmd.OpenReport "List of Accounts", PrintMode
Case 2
DoCmd.OpenReport "Quarter-wise Fee Report", PrintMode
Case 3
DoCmd.OpenReport "Account-wise Fee Report", PrintMode
Case 4
DoCmd.OpenReport "Difference in Projected and Actual Report",
PrintMode
End Select
DoCmd.Close acForm, "View Reports"
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 Command27_Click()
End Sub
Private Sub Preview_Click()
' Preview selected report. This procedure uses the PrintReports
' Sub procedure defined in (General) section of this module.
PrintReports acPreview
End Sub
Private Sub Print_Click()
' Print selected report. This procedure uses the PrintReports
' Sub procedure defined in (General) section of this module.
PrintReports acNormal
End Sub
Private Sub Command25_Click()
On Error GoTo Err_Command25_Click
Dim stDocName As String
stDocName = "Accountwise Fee Report"
DoCmd.OpenReport stDocName, acNormal
Exit_Command25_Click:
Exit Sub
Err_Command25_Click:
MsgBox Err.Description
Resume Exit_Command25_Click
End Sub
It has 3 reports against which I have an option button, a preview button,
print button and a cancel button.
But none of this button works, also I can select more than 1 option at a time
whereas i want only 1 option to be selected at a time.
Please Help
Any help would be appreciated as i am new to access.
Regards,
Dineh
I want to create a form where I will put in all the report names and then
preview or print or mail report based on the selection.
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![Sales Reports Dialog]!
SelectCategory"
Select Case Me!ReportToPrint
Case 1
DoCmd.OpenReport "List of Accounts", PrintMode
Case 2
DoCmd.OpenReport "Quarter-wise Fee Report", PrintMode
Case 3
DoCmd.OpenReport "Account-wise Fee Report", PrintMode
Case 4
DoCmd.OpenReport "Difference in Projected and Actual Report",
PrintMode
End Select
DoCmd.Close acForm, "View Reports"
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 Command27_Click()
End Sub
Private Sub Preview_Click()
' Preview selected report. This procedure uses the PrintReports
' Sub procedure defined in (General) section of this module.
PrintReports acPreview
End Sub
Private Sub Print_Click()
' Print selected report. This procedure uses the PrintReports
' Sub procedure defined in (General) section of this module.
PrintReports acNormal
End Sub
Private Sub Command25_Click()
On Error GoTo Err_Command25_Click
Dim stDocName As String
stDocName = "Accountwise Fee Report"
DoCmd.OpenReport stDocName, acNormal
Exit_Command25_Click:
Exit Sub
Err_Command25_Click:
MsgBox Err.Description
Resume Exit_Command25_Click
End Sub
It has 3 reports against which I have an option button, a preview button,
print button and a cancel button.
But none of this button works, also I can select more than 1 option at a time
whereas i want only 1 option to be selected at a time.
Please Help
Any help would be appreciated as i am new to access.
Regards,
Dineh