Looks like the error is coming from the record set rsClass which you advance until the EOF, then try to pull a field from it in the latter part of your code.