Il numero totale di record ottenuti lo conosci tramite la proprietà RecordCount. Potresti provare a ragionare in questi termini:
codice:
Totale = RS.RecordCount
Corrente = 1

While Not RS.EOF
If(Corrente MOD 2 = 1) Then boxtype = "first"
Else If(Corrente = Totale) Then boxtype = "last"
Else boxtype = "second"

' resto del codice
[...]

Corrente = Corrente +1
Rs.MoveNext
WEnd
Ciau!
- Dean