Custom record counter on subform?

HelenWy

Registered User.
Local time
Today, 14:24
Joined
Feb 3, 2009
Messages
30
Hi all

I hope someone can help me with this. I'm trying to put a custom record counter on a subform, but the code I am using doesn't seem to work. This is what I am using (on the subform module):

Code:
Private Sub Form_Current()
        Me.RecordsetClone.MoveLast
        Me.RecordsetClone.Bookmark = Me.Bookmark
        Me!Navlbl.Caption = (Me.RecordsetClone.AbsolutePosition + 1) & " of  " & Me.RecordsetClone.RecordCount
    End Sub

I have a label with the name "Navlbl" and it is unbound. When I open the form, and use one of my custom navigation buttons, I get the error "Run time error 438. Object doesn't support this property or method".

Can anyone help? I'm pretty much a novice at code, so if you're able to give me some different code to help, then some comments about what it is doing would be appreciated!

TIA for any responses.

Helen
 
You need to develop a sequence query to create pseudo record numbers (these will be unique each time the form is opened). However I do not know if that type of query is updatable.

I posted two examples of sequence queries last Fri I think.
 
OK, thank you. Will see if that helps.
 
When you get the error and go into debug, wat line does the error occur on?
 
cant you just show the navigation buttons - that contains a record counter

otherwise the total records for any bound form is simply

dcount("*",me.recordsource)
 
I could just show the nav buttons etc, but I wanted to have it look a bit nicer, that's all!
 
try a little test to identify wat is causin the error as yr syntax looks correct.
leave the label on screen, and navigate using the navigation buttons instead of yr custom one, do u stiil get the error message?
 
try a little test to identify wat is causin the error as yr syntax looks correct.
leave the label on screen, and navigate using the navigation buttons instead of yr custom one, do u stiil get the error message?

Just tried it, and yes - same error! If I really can't solve it, then I'll just use the default ones for now.
 
i know this is gonna sound silly, but are you sure that it is a label not a textbox?
go to your line in the code:

Me!Navlbl.

does caption come up in the list?
 
i know this is gonna sound silly, but are you sure that it is a label not a textbox?
go to your line in the code:

Me!Navlbl.

does caption come up in the list?

That doesn't sound silly at all because THAT WAS THE ANSWER! LOL! I'm such a fool...

Thank you! Could I just ask one more question - can I insert the word "Record" anywhere into that Caption, so that the label will read "Record x of y" rather than having to use another label just for the word "Record"?
 
course you can, u can put any string u wish in it:

Me!Navlbl.Caption = "Record: " & (Me.RecordsetClone.AbsolutePosition + 1) & " of " & Me.RecordsetClone.RecordCount)
 
course you can, u can put any string u wish in it:

Me!Navlbl.Caption = "Record: " & (Me.RecordsetClone.AbsolutePosition + 1) & " of " & Me.RecordsetClone.RecordCount
 

Users who are viewing this thread

Back
Top Bottom