Record numbering

stu_c

Registered User.
Local time
Today, 04:21
Joined
Sep 20, 2007
Messages
494
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
 
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
 
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
 
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

Back
Top Bottom