Public Function maxuse() as integer
con.Open()
sql = "select IIF(ISNULL(MAX(sms_count)), 0, MAX(sms_count)) from sms_master"
Com = New OleDb.OleDbCommand(sql, con)
maxuse = Com.ExecuteScalar()
'If _maxno = "&H0" Then
' _maxno = 0
'End If
Com.ExecuteNonQuery()
Com.Dispose()
con.Close()
End Sub</pre>
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
textbox1.text = maxuse() + 1
End Sub