PDA

Click to See Complete Forum and Search --> : Help, how can I get the lowest 4 field values from my DB?


JD
Jun 17th, 1999, 10:59 PM
First off, I apoligize if this is a stupid question, but I've racked my brain, and I'm at a loss. Did I mention I'm a beginner with VB? Here's what I want to do:

From my DB, I would like to select the records that contain the lowest 4 field values:

score name
10 BOB
11 ROB
33 SLOB
60 KNOB
90 MOB
22 MELVIN

From this, I want it to select the records that contain 10,11,22,33, HOW??????PLEASE HELP!!

------------------

JD
Jun 18th, 1999, 12:37 AM
Thank you Dennis, your help is greatly appreciated!

------------------

ruggerid
Jun 18th, 1999, 11:38 AM
Create a SQL query to open your recordset with the following syntax:

"SELECT TOP 4 tblWhatever.* FROM tblWhatever ORDER BY tblWhatever.Score DESC;"

In Access it will look like this:


Dim db as Database
Dim rst as Recordset
Dim strSql as String

strSql = "SELECT TOP 4 tblWhatever.* FROM tblWhatever ORDER BY tblWhatever.Score DESC;"

Set db = currentDb()
Set rst = db.openRecordset(strSql, dbOpenDynaset)

'do whatever you want from here.

rst.close
set rst = nothing

db.close
set db = nothing

Dennis