casomai l'errore sarà qui

rst![CodiceStato] = strStato

controlla la variabile strStato