Sort Property

See Also    Example    Applies To

Sets or returns the sort order for records in a CdbRecordset object (Microsoft Jet workspaces only).

Syntax

VOIDSetSort(LPCTSTR pstr );

CStringGetSort(VOID);

Parameters

Type Argument Description
LPCTSTR pstr A pointer to a string that contains the ORDER BY clause of an SQL statement without the reserved words ORDER BY.

Remarks

You can use the Sort property with dynaset- and snapshot-type CdbRecordset objects.

When you set this property for an object, sorting occurs when a subsequent CdbRecordset object is created from that object. The Sort property setting overrides any sort order specified for a CdbQueryDef object.

The default sort order is ascending (A to Z or 0 to 100).

The Sort property doesn't apply to table- or forward-only–type CdbRecordset objects. To sort a table-type CdbRecordset object, use the CdbIndex property.

Note In many cases, it's faster to open a new CdbRecordset object by using an SQL statement that includes the sorting criteria.