Record number

 

The Recordcount text box has no datasource - unbound

It has no event property

the code is in the form`s on current event

the code is:

Private Sub Form_Current()
On Error GoTo Err_navFormCurrent
Dim recClone As Object
Dim intNewRecord As Integer

' If this is a "New Record" then
' Disable the <Next>, <New>, <Last> buttons
' Enable the <First> and <Next> buttons
' Then Exit the procedure.
intNewRecord = IsNull(Me![txtName])
If intNewRecord Then
' cmdFirst.Enabled = True
' cmdNext.Enabled = False
' cmdPrevious.Enabled = True
' cmdLast.Enabled = False
' cmdNew.Enabled = False
Me![RecordCount] = "New Record"
Me.txtName.SetFocus ' Set focus to the Plant ID if a "New Record"
Exit Sub
Else
' Else if this is not a new record
' Enable <New> and <Last> buttons
' cmdNew.Enabled = True
' cmdLast.Enabled = True
End If

' Make a clone of the recordset underlying the form so
' we can move around without affecting the form's recordset
Set recClone = Me.RecordsetClone

' Check to see if there are no records
' If so disable all buttons except for the <New> button
If recClone.RecordCount = 0 Then
' cmdNext.Enabled = False
' cmdPrevious.Enabled = False
' cmdFirst.Enabled = False
' cmdLast.Enabled = False
Else
' Synchronise the current pointer in the two recordsets
recClone.Bookmark = Me.Bookmark
' If there are records, see if recordset is on the first record
' If so, disable the <First> and <Previous> buttons
recClone.MovePrevious
'cmdFirst.Enabled = Not (recClone.BOF)
'cmdPrevious.Enabled = Not (recClone.BOF)
recClone.MoveNext
' And then check whether recordset is on the last record
' If so, disable the <Last> and <Next> buttons
recClone.MoveNext
'cmdLast.Enabled = Not (recClone.EOF)
'cmdNext.Enabled = Not (recClone.EOF)
recClone.MovePrevious
End If


Me![RecordCount] = "Record " & (recClone.AbsolutePosition + 1) & " of " & _
DCount("*", "qry3HlpdeskOpenItems")

recClone.Close

Exit_navFormCurrent:
Exit Sub

Err_navFormCurrent:
If Err = 3021 Then
' Error 3021 means recordset is at Add New Record
' Enable <Previous> and <First> buttons
' Disable <Next> and <Last> buttons
Resume Exit_navFormCurrent
Else
MsgBox Err.Description
Resume Exit_navFormCurrent
End If

End Sub
-----------------------------------------------

The result is