Record numbering (1 Viewer)

stu_c

Registered User.
Local time
Today, 17:37
Joined
Sep 20, 2007
Messages
489
hi all
At the bottom of the form it shows record 1 of 10 for example, how do I show this on my actual form as I am removing this bottom bar and having my own footer instead
 

bob fitz

AWF VIP
Local time
Today, 17:37
Joined
May 23, 2011
Messages
4,725
Create a label called "labRecCount".
Put the following code in the forms OnCurrent event.
Code:
       If Me.NewRecord Then
            Me.labRecCount.Caption = "New Record (" & Me.RecordsetClone.RecordCount & " existing records)"
       Else
           Me.labRecCount.Caption = "Record " & [CurrentRecord] & " of " & Me.RecordsetClone.RecordCount
       End If
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 00:37
Joined
May 7, 2009
Messages
19,242
1. create a Public function:
Code:
Public Function udfRecords(f As Form)
With f
    udfRecords = .CurrentRecord & " of " & IIf(.NewRecord, .CurrentRecord, .Recordset.RecordCount)
End With
End Function

2. add an Unbound Textbox to your form.
on it's ControlSource:

=udfRecords([Form])

3. add code to the Current Event of the Form:

Code:
private sub form_current()
Me.UnboundTextboxName.Requery
end sub
 

stu_c

Registered User.
Local time
Today, 17:37
Joined
Sep 20, 2007
Messages
489
Thank you so much!

1. create a Public function:
Code:
Public Function udfRecords(f As Form)
With f
    udfRecords = .CurrentRecord & " of " & IIf(.NewRecord, .CurrentRecord, .Recordset.RecordCount)
End With
End Function

2. add an Unbound Textbox to your form.
on it's ControlSource:

=udfRecords([Form])

3. add code to the Current Event of the Form:

Code:
private sub form_current()
Me.UnboundTextboxName.Requery
end sub
 

Users who are viewing this thread

Top Bottom