Record Navigation

Evagrius

Registered User.
Local time
Today, 16:10
Joined
Jul 10, 2010
Messages
170
Hello all,

I have A form. I would like to have a textbox or label that tells you what record you are viewing out of how many records. In other words, I would like to duplicate exactly what is on the navigation at the bottom of the form.

The reason I would like to do this is because I want to make it easier for my co-workers to see.

I have already insterted a large cmd with "NEXT" and PREVIOUS". But bellow that I am trying to have a lable with large font to let the user know where they are. I've been trying to get it to work for a bit, but the only time my code fails is when the user applies filter. Thank you for any help!
 
Okay, first we need to clarify something.

The record number on the navigation in a normal form - means nothing. It is only good for the current session that the form has and if the recordset that the form is based on is requeried, or the form is reopened, that number isn't necessarily going to be on the same record.

If you want to have a meaningful record number show, you can show the primary key number. But a numbering of the records 8 of 54 for example is meaningless.
 
I think I understand Bob - is there a then to just copy what show in the navigation pane into a lable or txtbox? I am still learning - this is what I have been trying with - I know it is a mess . .

Code:
Option Compare Database
Dim Vcur As Variant
Dim ORS As DAO.Recordset

Code:
Private Sub Next_Click()
    ORS.MoveNext
    DoCmd.GoToRecord acDataForm, Me.Name, acNext
    If ORS.EOF Then ORS.MoveLast
    Vcur = ORS.Bookmark
    UpdateTB
Exit Sub

Code:
Sub UpdateTB()
Vcur = ORS.Bookmark
Dim icount As Integer:
ORS.MoveLast: icount = ORS.RecordCount
ORS.Bookmark = Vcur
Me.TXTMyPosition = ORS.AbsolutePosition + 1 & " OF " & icount
End Sub
 
If you just want to display your own Record X of Y status instead of using the built-in version then check out my old Record X of Y sample.
 

Users who are viewing this thread

Back
Top Bottom