Display x of y on form

G

Guest

If someone has removed the standard record count that usually is displayed at
the bottom of a form - how could I program a text box to display the same
information ie x of y

I need to include a record count not only on the main form but on each
subform (there are 3)
 
G

Guest

Put a textbox in the form's footer section. In the form's OnCurrent event,
put this code:

Me.txtRecCount = Me.Recordset.AbsolutePosition + 1 & " of " &
Me.Recordset.RecordCount

Barry
 
G

Guest

The code should all be on one line.
Replace txtRecCount with the actual name of your textbox.

Barry
 
G

Guest

Still getting a complie error: Method or data ember not found

Me.Recordset is highlighted

Sorry - not familiar with code usually just use wizards.....
 
G

Guest

Is your form bound to a table or query? If not, there is no such thing as a
record number.

Barry
 
G

Guest

I don't see why this shouldn't work. If you want, zip and send me your mdb:
barry dot gilbert at hunterdouglas dot com

Barry
 
G

Guest

add this to the code
Dim dbs AS Database
Dim rst AS Recordset

Set dbs = Current Db
rst = dbs.OpenRecorset(<put the name of your table here, in quotes)
Me.textRecCount = Me.rst.AbsolutePosition + 1 & "of " & me.rst.RecordCount


so, if your form is based off of a table called tblMyTable, the rst= line
would be
rst = dbs.OpenRecordset("tblMyTable")

got it?
 
G

Guest

Opening a recordset in code like this won't pick up the position of the
recordset behind the form.

Barry
 
G

Guest

i'm sorry, yeah. you are right. i just spend the last 3 days coding in VBA,
and my mind just went there. i think it was the op sayind about red colored
code, i though VBA.
 

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