MikeAinOz
MikeAinOz

Reputation: 128

Custom Record Navigation

Hi I have an App with nested sub-forms, the record navigation is confusing and I've started moving the Record Navigation controls to the top of the forms to improve that. I'm stuck on the 'n of n' field, is there a generic property(s)/query that will give me this?

Upvotes: 0

Views: 1054

Answers (1)

HansUp
HansUp

Reputation: 97101

For the first n, use the AbsolutePosition property of the form's RecordsetClone. see MSDN

For the second n, use the RecordCount property.

Update: I prefer Mike's approach using CurrentRecord. I created a form with 2 text boxes: txtCurrentRecord and txtRecordCount. Then this procedure for the form's On Current event causes the text boxes to display the same values as the built-in navigation bar.

Private Sub Form_Current()
    Me.txtCurrentRecord = Me.CurrentRecord
    If Not Me.NewRecord Then
        Me.txtRecordCount = Me.RecordsetClone.RecordCount
    Else
        Me.txtRecordCount = Me.CurrentRecord
    End If
End Sub

Update2: I added a procedure to Form Load to make sure RecordCount is accurate.

Private Sub Form_Load()
    Me.RecordsetClone.MoveLast
    Me.RecordsetClone.MoveFirst
End Sub

Upvotes: 1

Related Questions