B
billharrison9
I'm having a problem filtering a recordset and would appreciate your
suggestions on what's going wrong. I apply the filter to the first
recordset, then create another recordset from the filtered recordset.
My understanding is that this should work, but it isn't.
Here's the code
Dim dbInfo As Database
Dim rstLeadershipMasterFilteredBySelectedL3 As DAO.Recordset
Dim rstLeadershipFilteredForSector As DAO.Recordset
Set dbInfo = CurrentDb()
'Open the first recordset
Set rstLeadershipMasterFilteredBySelectedL3 =
dbInf
penRecordset("tblLeadershipMaster_FanChartData", dbOpenDynaset)
'Now, we apply the filter to the recordset
Debug.Print "Running sector " & strSector
rstLeadershipMasterFilteredBySelectedL3.Filter =
strFilterValue
Debug.Print rstLeadershipMasterFilteredBySelectedL3.Filter
'Open a recordset from the filtered recordset
Set rstLeadershipFilteredForSector =
rstLeadershipMasterFilteredBySelectedL3.OpenRecordset()
'Output a count of the records to see if the filter worked.
rstLeadershipFilteredForSector.MoveLast
Debug.Print "Record Count is " &
rstLeadershipFilteredForSector.RecordCount
rstLeadershipFilteredForSector.MoveFirst
The output remains unfiltered. Can you tell me what I've missed?
Thanks in advance!
suggestions on what's going wrong. I apply the filter to the first
recordset, then create another recordset from the filtered recordset.
My understanding is that this should work, but it isn't.
Here's the code
Dim dbInfo As Database
Dim rstLeadershipMasterFilteredBySelectedL3 As DAO.Recordset
Dim rstLeadershipFilteredForSector As DAO.Recordset
Set dbInfo = CurrentDb()
'Open the first recordset
Set rstLeadershipMasterFilteredBySelectedL3 =
dbInf
'Now, we apply the filter to the recordset
Debug.Print "Running sector " & strSector
rstLeadershipMasterFilteredBySelectedL3.Filter =
strFilterValue
Debug.Print rstLeadershipMasterFilteredBySelectedL3.Filter
'Open a recordset from the filtered recordset
Set rstLeadershipFilteredForSector =
rstLeadershipMasterFilteredBySelectedL3.OpenRecordset()
'Output a count of the records to see if the filter worked.
rstLeadershipFilteredForSector.MoveLast
Debug.Print "Record Count is " &
rstLeadershipFilteredForSector.RecordCount
rstLeadershipFilteredForSector.MoveFirst
The output remains unfiltered. Can you tell me what I've missed?
Thanks in advance!