Rectangle 27 0

Value of type 'Integer' cannot be converted to 'System.Data.OleDb.OleDbDataReader'.

Dim maxNumber As Int32 = Convert.ToInt32(cmd.ExecuteScalar())
TextBox1.Text = maxNumber.ToString

Suggesting a check for DBNull on MAX

The variable reading is a OleDbDataReader which can't be used to assign an integer, that's the reason for the error. But you don't need a DataReader anyway if you use ExecuteScalar:

Yes, maybe, hope that he never adds a where to the sql.