Question : How do I find the highest value in a column in a list box?

Hi experts,

I have a list box that contains 3 columns.  Column 3 has numbers in it.  For example,

First name    Last name    Random number
Lin                Stampton     45
Bill                 Jarvis           56
Adrian           Heely           23
Heather        Meager        19

Column 3 is a calculative field in the SQL that is random.  I need to display 56 in a msgbox when I click on a command button but I do not know how to do this.  If the figure was in a table I could use a DMax, but I am not sure how to do this when in a column in a list box.

Any help would be appreciated.

Regards
Terry

Answer : How do I find the highest value in a column in a list box?

you could try this to get the max value
use the iif statement to determine which col has the higher value for that row, col3 or col4

SELECT iif(col3>col4,col3,col4)
from mytable
order by 1 desc

Now wrap this with max and it will get us the one row

SELECT max(iif(col3>col4,col3,col4))
from mytable



Im loading myself with cookies as a interim fix, there goes my waistline lol
Random Solutions  
 
programming4us programming4us