MissB618
asked on
How can I add a custom record counter/navigation bar to my subform?
I have a subform within my main form. I need to add a custom navigation bar to the subform. I know how to add the "next record", "new record" and "previous record" buttons to my custom bar. What I do not know how to do is the "1 of 5" part of the record navigation bar.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you may need to add this codes too in the current event of the subform
Private Sub Form_Current()
Set rs = Me.RecordsetClone
rs.MoveLast
Me.txtRecCount = Me.CurrentRecord & " of " & rs.RecordCount
end sub
Private Sub Form_Current()
Set rs = Me.RecordsetClone
rs.MoveLast
Me.txtRecCount = Me.CurrentRecord & " of " & rs.RecordCount
end sub
MissB618,
The one line I posted will always show you the Record N of Total no matter what record you are on.
mx
The one line I posted will always show you the Record N of Total no matter what record you are on.
mx
Review this question. The asker was trying to do exactly what you are trying to accomplish.
https://www.experts-exchange.com/questions/22856605/Refresh-rs-RecordCount.html
This is the solution I provided. This will increment properly when you go to the new record.
If Me.Form.RecordsetClone.Rec ordCount > 0 Then
'Shows current record count
Set rs = Me.RecordsetClone
rs.MoveLast
If Me.NewRecord Then
Me.txtRecCount = Me.CurrentRecord & " of " & rs.RecordCount + (Me.CurrentRecord - rs.RecordCount) & " record(s)."
Else
Me.txtRecCount = Me.CurrentRecord & " of " & rs.RecordCount & " record(s)."
End If
Else
'Do nothing
End If
ET
https://www.experts-exchange.com/questions/22856605/Refresh-rs-RecordCount.html
This is the solution I provided. This will increment properly when you go to the new record.
If Me.Form.RecordsetClone.Rec
'Shows current record count
Set rs = Me.RecordsetClone
rs.MoveLast
If Me.NewRecord Then
Me.txtRecCount = Me.CurrentRecord & " of " & rs.RecordCount + (Me.CurrentRecord - rs.RecordCount) & " record(s)."
Else
Me.txtRecCount = Me.CurrentRecord & " of " & rs.RecordCount & " record(s)."
End If
Else
'Do nothing
End If
ET
ASKER
ET,
Where would I put this code?
Where would I put this code?
B618 ....
If you need to emulate the nav rec counter/display ... the put this as the Control Source for a text box the will display this information:
=[Form].[CurrentRecord] & " of " & [Form].[RecordsetClone].[R ecordCount ]
mx
If you need to emulate the nav rec counter/display ... the put this as the Control Source for a text box the will display this information:
=[Form].[CurrentRecord] & " of " & [Form].[RecordsetClone].[R
mx
MissB618 ...
>>>>ET,
Where would I put this code?<<<<<
Put the code in the On Current Event of your form.
ET
>>>>ET,
Where would I put this code?<<<<<
Put the code in the On Current Event of your form.
ET
=[Form].[CurrentRecord] & " of " & [Form].[RecordsetClone].[R
Don't forget the equals sign.
mx