Results 1 to 3 of 3

Thread: Help, how can I get the lowest 4 field values from my DB?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 1999
    Posts
    2

    Post

    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!!

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

  2. #2

    Thread Starter
    New Member
    Join Date
    Jun 1999
    Posts
    2

    Post

    Thank you Dennis, your help is greatly appreciated!

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

  3. #3
    New Member
    Join Date
    Apr 1999
    Location
    Washington DC USA
    Posts
    3

    Post

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width