Solved

Doing SELECT, GROUP, ORDER on .DBF files ?

Posted on 1998-12-30
1
172 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now