Solved

ORDER BY in Recordset filter

Posted on 2004-03-26
11
1,513 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 80 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 20 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 20 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

690 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