how to show Record 'x' of Total 'y'

Franky G

Registered User.
Local time
Today, 06:21
Joined
Feb 6, 2001
Messages
62
Hi,

How do I display which record is currently being viewed? I don't want to display the standard Record Selectors, I want to create custom controls.

I want to show 'Viewing Record 'x' of 'y' on the form.
I've got the second part, a text box with control =Count([File No]), how would I get the 'x' value.....and would I have to add some 'afterupdate' code to my custom record controls to update 'x'?

Thanks for any help,

FrankyG
 
Sub Form_Current()
On Error GoTo Form_Current_Err

Me.txtCurrRec = Form.CurrentRecord
Me.txtTotalRecs = Form.RecordsetClone.RecordCount + IIf(Form.NewRecord, 1, 0) & " " & "(filtered)"
 
Ok....that works but why do you add the 'filtered' to the end of the IIf statement?

Also, when the form is loaded and record 1 is displayed, the Me.txtTotalRecs field shows 1. It only updates when another record is selected. It's a minor point, but is that normal behaviour?

thx

Frank
 
Aloha...

This is from ghudson at another forum:

------------
I use this to create my own record X of Y info...

Private Sub Form_Current()

If Me.NewRecord Then
Me.lRecordXofY.Caption = "New Record (" & DCount("*", "TableA") & " existing records)"
Else
Me!lRecordXofY.Caption = "Record " & [CurrentRecord] & " of " & DCount("*", "TableA")
End If
End Sub

The above is using a label named "lRecordXofY" and a table named "TableA".

-------------

Tana
 
Thanks for the credit Tana. :D

I do want to state that my code does accuratly display the X and Y at ALL times (when the form is first opened, for each current record, etc.).

I personally like to display my Record X of Y info in the form's "caption" field for I usally have my form set to "popup" as a modal for that custom look.

Private Sub Form_Current()
If Me.NewRecord Then
Me.Form.Caption = "Your Form Name - New Record (" & DCount("*", "YourTableQueryNameHere") & " existing records)"
Else
Me.Form.Caption = "Your Form Name - Record " & [CurrentRecord] & " of " & DCount("*", "YourTableQueryNameHere")
End If
End Sub

HTH
 

Users who are viewing this thread

Back
Top Bottom