|
-
July 6th, 1999, 02:07 PM
#1
CRecordSet -->Sort
Hi all,
How do I get the data out of my Access-Database into my flexgrid, sorted on one of the recordfields, chosen by me?
I can get the data into my flexgrid, but only sorted on the ID-number.
m_...Set.SetCurrentIndex(recordfieldvariable)
gives no error, but a Debug Assertion Failure.
Thanx.
Student Flanders Language Valley
Programmer
-
July 6th, 1999, 02:15 PM
#2
Re: CRecordSet -->Sort
From the on-line help for DAO:
Records returned from a table-type recordset can be ordered only by the indexes defined for the underlying tabledef. To sort records in some other order, you can open a dynaset-type or snapshot-type recordset using an SQL ORDER BY clause stored in CDaoRecordset::m_strSort.
-
July 7th, 1999, 02:32 AM
#3
Re: CRecordSet -->Sort
Where can I get more info concerning this subject?
Student Flanders Language Valley
Programmer
-
July 9th, 1999, 11:24 AM
#4
Re: CRecordSet -->Sort
You are not really using CRecordSet are you? SetCurrentIndex is a method of CDaoRecordSet.
Anyway, all you need to do is set up your m_strSort variable before you do an Open() or Requery() for your recordset any the sort should take place. On-line help exists for CDaoRecordSet::m_strSort.
Here is an example:
pConditionsSet->m_strSort = "[ConditionSetID], [Logic]DESC, [FieldID]";
This sorts my recordset in ascending ConditionSetID, descending Logic and ascending FieldID.
After setting the m_strSort variable make your call to Open() or Requery().
Hope this helps.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|