Click to See Complete Forum and Search --> : Recordset in ADC


kuvo
August 7th, 1999, 04:00 PM
Hi ,
I want to loop thru my whole "empoyees" table:

rs.Open "employees", , , cmdTable
rs.MoveFirst
Do while not rs.EOF
...
rs.MoveNext

The problem is if my table happens to be empty, right after the statement : rs.Movefirst, the program bumps. How can I control this ?

Thanks

Rufus
August 8th, 1999, 12:36 PM
rs.Open "employees", , , cmdTable

If Not rs.EOF And Not rs.BOF Then
rs.MoveFirst
Do while not rs.EOF
...
rs.MoveNext
Loop
End If

If you have at least one record, both EOF and BOF cannot be true, at the same time...

kuvo
August 8th, 1999, 01:28 PM
Hi Rufus,
I really appreciate your reply.

Thx

thanigai
September 8th, 1999, 01:08 PM
Hello Friend,

After you open the recordset, check whether the rs.recordcount >0.
i.e.
If rs.recordcount>0 then
rs.movefirst
..............
.......
endif


Don't Worry! Be Happy!!