I have inherited this database with the following code, and up until today, it worked. Now, when the code is executed I get an "Error 3265 Item not found in this collection." I really have no idea what this means. And, I don't really know where in the code it gets the error (a user found it while in the GUI); I don't know how to debug code.
I don't know if this matters, but I split the database a couple of days ago.... Don't remember the error after splitting, but maybe I never tested this area.
Any help would be greatly appreciated!!!!!
---------------
Public Sub SetReportVariables(strReportName As String)
'This procedure sets the form display variables for the
'report name provided
On Error GoTo ErrHandler
'Declare procedure variables
Dim djetDB As Database, rsnpReports As DAO.Recordset, _
strCriteria As String
'Set procedure variables
Set djetDB = CurrentDb
Set rsnpReports = djetDB.OpenRecordset("tblReports", dbOpenSnapshot)
strCriteria = "ReportName = '" & strReportName & "'"
'Read the recordset
rsnpReports.MoveLast
'Find the specified report and set display variables for that report
With rsnpReports
.FindFirst strCriteria
blnSelectOperUnit = !SelectOperatingUnit
blnSelectDiv = !SelectDivs
blnSelectLoc = !SelectLocs
blnSelectDept = !SelectDepts
blnSelectJobTitle = !SelectJobs
blnSelectEmplID = !SelectEmpID
blnSelectName = !SelectNames
blnSelectDate = !SelectDate
blnSelectMonth = !SelectMonth
'close recordset
.Close
End With
ExitSub:
Exit Sub
ErrHandler:
MsgBox Err & " " & Err.Description
Resume ExitSub
End Sub
I don't know if this matters, but I split the database a couple of days ago.... Don't remember the error after splitting, but maybe I never tested this area.
Any help would be greatly appreciated!!!!!
---------------
Public Sub SetReportVariables(strReportName As String)
'This procedure sets the form display variables for the
'report name provided
On Error GoTo ErrHandler
'Declare procedure variables
Dim djetDB As Database, rsnpReports As DAO.Recordset, _
strCriteria As String
'Set procedure variables
Set djetDB = CurrentDb
Set rsnpReports = djetDB.OpenRecordset("tblReports", dbOpenSnapshot)
strCriteria = "ReportName = '" & strReportName & "'"
'Read the recordset
rsnpReports.MoveLast
'Find the specified report and set display variables for that report
With rsnpReports
.FindFirst strCriteria
blnSelectOperUnit = !SelectOperatingUnit
blnSelectDiv = !SelectDivs
blnSelectLoc = !SelectLocs
blnSelectDept = !SelectDepts
blnSelectJobTitle = !SelectJobs
blnSelectEmplID = !SelectEmpID
blnSelectName = !SelectNames
blnSelectDate = !SelectDate
blnSelectMonth = !SelectMonth
'close recordset
.Close
End With
ExitSub:
Exit Sub
ErrHandler:
MsgBox Err & " " & Err.Description
Resume ExitSub
End Sub