?
Solved

ORDER BY in Recordset filter

Posted on 2004-03-26
11
Medium Priority
?
1,515 Views
Last Modified: 2012-08-14
Hi,

Does ORDER BY work in recordset filter??  I tried it, but it did not???  Thanks
0
Comment
Question by:mcrmg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +3
11 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 10686957
Hi mcrmg,

No but it should preserve any existing orderby clause used to generate the base recordset.

Tim Cottee
Brainbench MVP for Visual Basic
http://www.brainbench.com
0
 

Author Comment

by:mcrmg
ID: 10687020
So, if I want to change order, I can not use filter??
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 10687144
filter will just Filter by field you may wanna change the recordsource and then requery
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 43

Expert Comment

by:TimCottee
ID: 10687146
mcrmg,

No, all this does is a apply a filter as the name suggests. If you want to change the order you need to requery with a different order by clause or display the data in a control that supports sorting.

Tim.
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 10687208
It is generally best not to use the filter. Here is why:

If you want certain records in a certain order, using a specific SQL select will bring only those necessary records into the recordset. If, however, you use the filter, you bring over all records to the recordset and then filter out the unnecessary records. This is not an efficient way to do things.

FtB
0
 
LVL 9

Accepted Solution

by:
AlfaNoMore earned 320 total points
ID: 10687239
objRS.Filter = "X='Y'"
objRS.Sort "X Desc, Z Asc"
0
 

Author Comment

by:mcrmg
ID: 10688022
@fritz_the_blank,

What if it always return, say, 100 records, I just want to see that in different order??
0
 

Author Comment

by:mcrmg
ID: 10688024
@fritz_the_blank,

What if it always return, say, 100 records, I just want to see that in different order??
0
 
LVL 46

Assisted Solution

by:fritz_the_blank
fritz_the_blank earned 80 total points
ID: 10688115
If you are just trying to work with a small subset, then that would be fine. Just make sure that you have SQL do as much of the work as you can rather than using the recordset object to do so. The former is much more efficient than the latter.

http://www.w3schools.com/ado/prop_rs_filter.asp

Fritz the Blank
0
 
LVL 4

Assisted Solution

by:mistyrae
mistyrae earned 80 total points
ID: 10691014
It is inefficient to do it this way, but you can use the .Sort property of the recordset to complete the operation...

Something like oRs.Sort = "MyField DESC"

You can use the Filter on your recordset and then sort it if you want to.

This page http://www.devguru.com/Technologies/ado/quickref/recordset_sort.html explains the options that are available with this method.
- misty
0
 
LVL 4

Expert Comment

by:mistyrae
ID: 10691019
pardon me, AlfaNoMore completely had it covered ;)
(I just like to type)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question