Friends,
I want to get and display the Max value from database records. I used some codes. It displays the error message 'NULL"
how to rectify this.
Dim CheNo As Integer
Dim rsCheNo As New ADODB.Recordset
rsCheNo.Open "SELECT max(CHEMICALS.C hemicalCode) FROM CHEMICALS", CN, adOpenDynamic, adLockOptimisti c
If rsCheNo.RecordC ount <> 0 Then
Do While Not rsCheNo.EOF
CheNo = rsCheNo.Fields( 0)
rsCheNo.MoveNex t
Loop
End If
rsCheNo.Close
CheNo = CheNo + 1
Text1 = CheNo
Thanks,
Suresh
I want to get and display the Max value from database records. I used some codes. It displays the error message 'NULL"
how to rectify this.
Dim CheNo As Integer
Dim rsCheNo As New ADODB.Recordset
rsCheNo.Open "SELECT max(CHEMICALS.C hemicalCode) FROM CHEMICALS", CN, adOpenDynamic, adLockOptimisti c
If rsCheNo.RecordC ount <> 0 Then
Do While Not rsCheNo.EOF
CheNo = rsCheNo.Fields( 0)
rsCheNo.MoveNex t
Loop
End If
rsCheNo.Close
CheNo = CheNo + 1
Text1 = CheNo
Thanks,
Suresh
Comment