Determine if this is the first record in a Recordset

T

Tony A.

I'm trying to use an If statement to determine if this is the first record in
a recordset. I've tried
if rs.BOF then
code
end if

Any suggestions?
 
M

Marshall Barton

Tony A. said:
I'm trying to use an If statement to determine if this is the first record in
a recordset. I've tried
if rs.BOF then
code
end if


You can use rs.MoveFirst to be sure you're at the first
record.

To check if you're at a specific record, check the
recordset's AbsolutePosition property:

If rs.AbsolutePosition = 1 Then
' first record
End If
 
Top