Discussion Locked

DataCombo And Filtered Recordsets

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

(Assume all the necessary and proper variables have been declared.)
'Filter ADO recordset
ADOEmpFile.Recordset.Filter ="Lname = 'Smith'"
'Count filtered records
LongRecs = ADOEmpFile.Recordset.RecordCount
'The value of LongRecs = 100 in Debug.Print
'indicated that the filter worked.
'
'Now, populate DataCombo1 with filtered
'recordsets
With DataCombo1
Set .RowSource = ADOEmpFile.Recordset
.ListField = "Lname"
End With
After the execution of the With segment above, the DataCombo1 should have only 100 records in its listfield, I think, but it has 5000 records, a list of all the last names in the entire Employee file. What am I doing wrong? I only want all last names with Smith to befiltered into the DataCombo1. Please Help!

5 replies

This discussion is closed to new replies.