Display Record Number

M

MikeS

How do I display the current record number in a text box on a form. I don't
want to use the standard navigation buttons at the bottom of the form.

Can anyone assist me with this please?

Thanks in advance
 
K

Klatuu

The recordset will need to be opened as dbOpenDynaset.

Set rst = CurrentDb.OpenRecordset("MyTableName", dbOpenDynaset)
If rst.RecordCount <> 0 Then
rst.MoveLast
rst.MoveFirst
End If

lngCurrRec = rst.AbsolutePosition 'Shows current record number

Note this is 0 based. The first record will be 0 and the last record will
be Recordcount - 1
 
Top