Sort Property

The Sort property on a Recordset object indicates that a recordset should be sorted.

Recordset.Sort BSTR Criteria
 

Parameters

Criteria
This parameter specifies the criteria used for sorting the Recordset object. This Sort property contains a comma-delimited list of column names and a direction specifier (ascending or descending) to be used for sorting records in a Recordset object. The direction specifier is a string (ASC or DESC). When a direction is not specified, the direction defaults to ascending.

An example of a Sort property criteria is as follows:

Remarks

The Recordset Sort property is used with an open Recordset object based on an AS/400 physical file. The Sort property allows the user to indicate which logical view to apply to an AS/400 physical file. The logical view must be a valid index specified in the description of the AS/400 physical file. The logical view is provided by the AS/400 logical file. The OLE DB Provider for AS/400 and VSAM responds to a Sort request by first closing the open physical file, and then opening the logical file that points back to the data in the physical file.

The Recordset Sort property is only supported on AS/400 hosts. If the user opens a Recordset object based on an AS/400 logical file, then there is likely no need to use Recordset.Sort. For performance reasons, applications should be written to open the AS/400 logical file first, because the overhead is so much greater when opening a physical file first.

If the CursorLocation property is set to adUseClient (use the client cursor engine), the Sort property will work if MDAC 2.0 is installed but will not work properly with earlier versions of ADO.