Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Doing SELECT, GROUP, ORDER on .DBF files ?

Posted on 1998-12-30
1
Medium Priority
?
231 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 200 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
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…
Suggested Courses

877 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