coding navigation button record x of y

socko139

Registered User.
Local time
Today, 22:51
Joined
Feb 22, 2001
Messages
25
Hello all,

Im trying to code my own navigation record x of y record box. (The navigation button that shows record 1 of X) I turned navigation buttons off and already created the other buttons (add new record, first record previous...etc.), but I'm having trouble creating the box that shows me which record I'm on. A friend helped me by informing
me to create a *label* on my form named lblNavigate then insert this code into my form in OnCurrentEvent .. . .

Private Sub Form_Current()
If Me.NewRecord Then
Me!lblNavigate.Caption = "New Record"
Else
With Me.RecordsetClone
.Bookmark = Me.Bookmark

**** Me!lblNavigate.Caption= "Record "&_
.CurrentRecord _
& " of " & .RecordCount
***
End With
End If
End Sub

When I do this and view my form nothing happens. I have no idea why. Maybe my code is wrong, maybe my friend was wrong when he told me to create a "label" called lblNavigate. The error I receive says "Object doesn't
support this property or method" and in my vb it errors right around where I put stars (***). Im thinking my friend was wrong when he told me to create a label called lblNavigate as opposed to a text box or something...but when I tried this in my text box it said #Name... and not the record number.

Can anyone help me.. Hope this all makes sense...if not I guess from scratch, how do I do this.
Thank you sooooo much!!
 
The code below works.

If Me.NewRecord Then
Me!lblNavigate.Caption = "New Record"
Else
With Me.RecordsetClone
.Bookmark = Me.Bookmark
Me!lblNavigate.Caption = "Record " & Me.CurrentRecord & " of " & .RecordCount
End With
End If
 

Users who are viewing this thread

Back
Top Bottom