Solved

Doing SELECT, GROUP, ORDER on .DBF files ?

Posted on 1998-12-30
1
208 Views
Last Modified: 2013-12-25
Hi,
i am using the following to open & access a .dbf file:
Set Db = Ws.OpenDatabase(App.Path,True,False,"dBASE IV")

To move the pointer, or do the next search:
Set Rs = Db.OpenRecordset("SELECT * FROM...WHERE...", dbOpenForwardOnly)

My Question:
The above selects line by line. If so, how can i do a GROUP, ORDER(ie.sort) on a selected list of results from a .DBF file ?? Or what would be the optimal way to do ?

Thanks for your advise,
Collin
0
Comment
Question by:collinng
1 Comment
 
LVL 3

Accepted Solution

by:
vbWhiz earned 50 total points
ID: 1498610
To sort by a field simply add an 'ORDER BY' clause to the SELECT statement.

for ascending order
SELECT FROM... WHERE... ORDER BY tbl.fld;

for descending order
SELECT FROM... WHERE... ORDER BY tbl.fld DESC;

multiple fields to sort
SELECT FROM... WHERE... ORDER BY tbl.fld1, tbl.fld2 DESC, tbl.fld3;

So when you grab the first row it has already been sorted and is the first row in the sort order.


I hope this helps you out!
0

Featured Post

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!

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

749 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