Discussion Locked

RecordSet Filter

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

I populate a Datalist object with customerid
field from an ADO Recordset.
And, I have a VB6 script to filter the recordset:
datCustomer.Recordset.Filter _ = "customerId Like 'B%'"
This code just positions the cursor at the first occurence ofthe customerid beginning with the letter B. The result set coexists with customerids beginning with other letters other than B. How do I achieve having all Bs only showing in the Datalist?

7 replies

by andrew

Are you sure? Filter show only matching records, but Find does what you're talking about.

This code worked properly for me:

Dim oCon As ADODB.Connection
Dim oRs As ADODB.Recordset

Set oCon = New ADODB.Connection
oCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Microsoft Visual Studio\VB98\Biblio.mdb;"
Set oRs = New ADODB.Recordset
oRs.Open "select Author from Authors", oCon
oRs.Filter = "Author like 'B%'"
Do
List1.AddItem oRs!Author
oRs.MoveNext
Loop Until oRs.EOF

by andrew

I provided the ADO logic you needed.

Once you have the proper result set, you can use it anyway you like.

This discussion is closed to new replies.