VB6 - ADO Data Control and DataGrid - sort order issues with RecordSet.Find
Posted on 2004-11-04
I am using an ADO data control (MSADODC.OCX) as the DataSource of a DataGrid
(MSDATGRD.OCX). Just for this simple example, let's say I have a MS SQL
Server table that contains some names. I initially populate the grid with a
statement like this:
adodc.RecordSource = "select name from my_table order by name"
In this example the names are sorted on the DataGrid as shown here:
Here we see that O'MALLEY is first of the O's. This is correct in
accordance with the ASCII sort order of the characters. However, if I try
to use find search criteria to move to the first record where name is
greater than or equal to OR
adodc.RecordSet.Find "name >= 'OR'"
It moves to O'MALLEY. It should move to OREGON. When doing a Find using a
search string that starts with an O, the search gets "stuck" on O'MALLEY.
Other Find searches work perfectly. For instance
adodc.RecordSet.Find "name >= 'PI'"
moves to PITTSBURGH. Can anyone provide a solution to this problem?