Record Number

  • Thread starter Thread starter Eli
  • Start date Start date
E

Eli

I am trying to put a control in form that will show the
record number currently on. I was not able to find any
function that just simply displays the record number, not
the ID. Is there anybody there that know how to
accomplish that?

Thanks,
 
Hi, place this code behind the form:

Private Function getRecordNumber() As Long
Dim rst As DAO.Recordset
Dim lngReturn As Long

Set rst = Me.RecordsetClone

If Me.NewRecord Then
rst.MoveLast
lngReturn = rst.AbsolutePosition + 2
Else
rst.Bookmark = Me.Bookmark
lngReturn = rst.AbsolutePosition + 1
End If

getRecordNumber = lngReturn
End Function

Create a text control on the form and set its ControlSource to
"=getRecordNumber()" (without quotes, of course).

Hope this helps, Graeme.
 
May be easier to place a Calculated Control (TextBox) and set the
ControlSource to:

= CurrentRecord

(including the equal sign)?
 
Back
Top