Are u using a server side cursor?? The code above will work only for client side cursors. For serverside cursors, the values of recordcount and absoluteposition are returned wrong.

Secondly, ain't these two statements the same (dglienna)?
ProgressBar1.Value = int(rsmain.AbsolutePosition * 100 / rsmain.RecordCount)

ProgressBar1.Value = int(rsmain.AbsolutePosition / rsmain.RecordCount) * 100