stai facendo un confronto tra un oggetto recordset e una variabile numerica.
Dovresti trasformare nello stesso tipo al momento del confronto
codice:
if CInt(maxID) = rif then