BOF stands for Beginning of File, EOF for End of File so that won't work.
If you know there will always be at least x images then you can loop using
For I = 1 to x
' do something
An alternative is just to increment a variable at the end of every loop and see if you've reached x. Otherwise I think you need rs.AbsolutePosition but I haven't use ADO for years and can't remember if that property is always available, it may depend on the cursor type used.
Joe (Microsoft MVP - XML