Results 1 to 2 of 2

Thread: Return Min & Max variables.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2002
    Location
    Thunder Bay, ON
    Posts
    89

    Return Min & Max variables.

    Hi,

    After pulling a collection of scores from a DB, I am trying to display the MIN and MAX of the numbers being returned as well as all the other corresponding information.

    I have been trying to do this inside of my loop.

    I know this is a simple procedure however I am unable to figure it out.

    Thanks
    "That is just it: you must have the devil in you to succeed in any art."

  2. #2
    Frenzied Member andreys's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,615
    Use SQL;

    Code:
    SELECT Min(ScoreFieldName) As MinimumScore FROM Table
    
    SELECT Max(ScoreFieldName) As MaximumScore FROM Table
    Or inside of loop

    Code:
    Dim minScrore, maxScore
    
    ...open recordset...
    
    
    do unitl rs.eof
       if minScore > rs("ScoreField") then minScore=rs("ScoreField")
       if maxScore < rs("ScoreField") then maxScore=rs("ScoreField")
       rs.movenext
    loop

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