Navigation Button Customize

V

Vince

Hello,

I was recommended this site for a code but is
getting "compile error member or data member not found"
what am I doing wrong....I already created a textbox
named lblnavigate which is unbound..Please help.

Thanks!
Vince


http://www.mvps.org/access/forms/frm0026.htm

(Q) I'm using my own Navigation Buttons for my forms
and have set the same property of the form to False. How
can I duplicate "Record x of y" label that appears in the
standard Navigation toolbar?

(A) Given that you have a label on the form called
lblNavigate, put this code
in the form's OnCurrent Event.


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
 
C

Cheryl Fischer

Vince,

Instead of this:
Me!lblNavigate.Caption = "Record " & _
.CurrentRecord _
& " of " & .RecordCount

try this:

"Record " & Me.CurrentRecord & _
" of " & Me.RecordsetClone.RecordCount

You need to use the Form's CurrentRecord property to get the current record
number.

hth,
 
S

Stephen Lebans

Here's a set of customised Nav Buttons ready to go:
http://www.lebans.com/recnavbuttons.htm
RecordNavigationButtons is an MDB containing code to replace the
standard Navigation Buttons. The custom buttons exactly emulate the
standard navigation bar including the autorepeat property.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
V

Vince

Hi Cheryl,

"Record " & Me.CurrentRecord & _
" of " & Me.RecordsetClone.RecordCount

I copied and pasted this into the forms OnCurrent Event
and it is all red? Sorry I am a Novice at coding?

Will this output the record count to my lblnavigation
textbox?

Thanks
Vince
 
C

Cheryl Fischer

I could have done that better. Make it:

Me!lblNavigate.Caption = "Record " & Me.CurrentRecord & _
" of " & Me.RecordsetClone.RecordCount
 
V

Vince

Hi Cheryl,
Thanks for the update but I put in your code into the
forms OnCurrent event....

Me!lblNavigate.Caption = "Record " & Me.CurrentRecord &
_
" of " & Me.RecordsetClone.RecordCount

I received "RUN-TIME error '438' Object doesn't support
this property or method" error message.

Please and many thank you's!

Vince
 
V

Vince

Thanks Stephen, this helps us Newbies
-----Original Message-----
Here's a set of customised Nav Buttons ready to go:
http://www.lebans.com/recnavbuttons.htm
RecordNavigationButtons is an MDB containing code to replace the
standard Navigation Buttons. The custom buttons exactly emulate the
standard navigation bar including the autorepeat property.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.




.
 
C

Cheryl Fischer

Hmmm. Works fine for me. Would you please post all of the code that you
are using in the OnCurrent event of the form.
 
V

Vince

Realy?

I have nothing in OnCurrent I must be doing something
wrong....but the minute I paste the code in it turns RED?

thanks....
 
C

Cheryl Fischer

Vince,
I have nothing in OnCurrent

We started out with this code in the On Current event of your form:

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

I suggested that you comment out one piece of the code and replace it with
another. Your code in the On Current event of the form should now look like
this:

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

or this:

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

When code is copied from a newsgroup posting and dropped into the VB editor,
it often appears red because the news reader has wrapped or broken a line in
such a manner as to make it unacceptable in the VB editor. You may have to
edit such code to correct these line breaks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top