[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 440
  • Last Modified:

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.
0
MissB618
Asked:
MissB618
  • 3
  • 2
  • 2
  • +1
1 Solution
 
Rey Obrero (Capricorn1)Commented:
create a textbox txtReccount


Private Sub Form_Load()
Set rs = Me.RecordsetClone
rs.MoveLast
    Me.txtRecCount = Me.CurrentRecord & " of " & rs.RecordCount


end sub
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Add a text box on your subform and set the Control Source to the following expression:

=[Form].[CurrentRecord] & " of " & [Form].[RecordsetClone].[RecordCount]

Don't forget the equals sign.

mx
0
 
Rey Obrero (Capricorn1)Commented:
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
0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
MissB618,

The one line I posted will always show you the Record N of Total no matter what record you are on.

mx
0
 
Eric ShermanAccountant/DeveloperCommented:
Review this question.  The asker was trying to do exactly what you are trying to accomplish.

http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_22856605.html

This is the solution I provided.  This will increment properly when you go to the new record.


If Me.Form.RecordsetClone.RecordCount > 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
0
 
MissB618Author Commented:
ET,
Where would I put this code?
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
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].[RecordCount]

mx
0
 
Eric ShermanAccountant/DeveloperCommented:
MissB618 ...

>>>>ET,
Where would I put this code?<<<<<

Put the code in the On Current Event of your form.


ET
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now