SQL query statements can have an ORDER BY clause and a WHERE clause. The CRecordset class has a public data member m_strSort that holds the text of the ORDER BY clause (excluding the words "ORDER BY"). Another public data member, m_strFilter, holds the text of the WHERE clause (excluding the word "WHERE"). You can set the values of these strings prior to opening the recordset.