I have a form- View Reports this has a combo box listing all the Reports available. When the user clicks on a report the user is asked to put in certain info such as Start Dates and Ending Dates.
However if the user cancels this operation when the Parameter box is on the screen the Run-time error 2501 appears, asking to debug.
My code for the View button is-
Option Compare Database
Option Explicit
Private Sub Print_Click()
End Sub
Private Sub View_Click()
DoCmd.OpenReport cboReports, acPreview
End Sub
Private Sub ElectricDateFinder_Click()
On Error GoTo Err_ElectricDateFinder_Click
Dim stDocName As String
stDocName = "ReferBackDateElectricity"
DoCmd.OpenReport stDocName, acPreview
Exit_ElectricDateFinder_Click:
Exit Sub
Err_ElectricDateFinder_Click:
MsgBox Err.Description
Resume Exit_ElectricDateFinder_Click
End Sub
Private Sub View_Click()
This is the section it highlights for debugging.
DoCmd.OpenReport cboReports, acPreview
End Sub
Please can someone help!
However if the user cancels this operation when the Parameter box is on the screen the Run-time error 2501 appears, asking to debug.
My code for the View button is-
Option Compare Database
Option Explicit
Private Sub Print_Click()
End Sub
Private Sub View_Click()
DoCmd.OpenReport cboReports, acPreview
End Sub
Private Sub ElectricDateFinder_Click()
On Error GoTo Err_ElectricDateFinder_Click
Dim stDocName As String
stDocName = "ReferBackDateElectricity"
DoCmd.OpenReport stDocName, acPreview
Exit_ElectricDateFinder_Click:
Exit Sub
Err_ElectricDateFinder_Click:
MsgBox Err.Description
Resume Exit_ElectricDateFinder_Click
End Sub
Private Sub View_Click()
This is the section it highlights for debugging.
DoCmd.OpenReport cboReports, acPreview
End Sub
Please can someone help!