Hello Guyzz..

I have a little problem here..I know this might be very easy to some people but I dont know why this become problem to me!
This is a codes to find a maximum number. But I dont know why when it trace a comparison between single digit number and 2 digit number, the data not accurate anymore. Example:

initial max = 0
DocID = 4, 8 , 10 , 12

PROBLEM: when max = 8 , compare to DocID = 10, the max value still remains as 8!

VB Code:
  1. Do While Not DataSISPEDA.Recordset.EOF
  2.        
  3.             If max <= Trim(DataSISPEDA.Recordset.Fields("DocID").Value) Then
  4.                
  5.                 max = Trim(DataSISPEDA.Recordset.Fields("DocID").Value)
  6.                 DataSISPEDA.Recordset.MoveNext
  7.            
  8.             Else
  9.                
  10.                 DataSISPEDA.Recordset.MoveNext
  11.            
  12.            End If
  13.        
  14.     Loop

I cannot find any error here..Plz anyone help me on this..