I have a simple form in an Access Project (2003) where a user selects a value from a dropdown list and clicks "Submit"; which runs VBA code to open a report with the selected value used in the where clause. The form works perfectly on my computer and most client computers. However there is one client computer who consistently gets the "runtime error 2501" message when the VBA code tries to open the report. I'm guessing it may have something to do with macro security or maybe SP2, but I'm at a complete loss at what to do. The code is below for reference. Any help is appreciated.
Eric
Private Sub cmdSubmit_Click()
vWhere = "course_id = '" & CourseID & "'"
vReportName = "rptEvaluation"
'Open report if it is closed.
If CurrentProject.AllReports(vReportName).IsLoaded = False Then
DoCmd.OpenReport vReportName, acViewPreview, , vWhere '*****Code Fails Here*****
Else
'Close report and open it again.
DoCmd.Close acReport, vReportName
DoCmd.OpenReport vReportName, acViewPreview, , vWhere
End If
End Sub
Eric
Private Sub cmdSubmit_Click()
vWhere = "course_id = '" & CourseID & "'"
vReportName = "rptEvaluation"
'Open report if it is closed.
If CurrentProject.AllReports(vReportName).IsLoaded = False Then
DoCmd.OpenReport vReportName, acViewPreview, , vWhere '*****Code Fails Here*****
Else
'Close report and open it again.
DoCmd.Close acReport, vReportName
DoCmd.OpenReport vReportName, acViewPreview, , vWhere
End If
End Sub