Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting records

Status
Not open for further replies.

JanesC

Technical User
Jan 15, 2002
29
GB
How do i get Access to display "Record 2 of 10 records" on a form. At the moment I've got it to display the total number of records using this control source:
=" (" & Count(*) & " " & IIf(Count(*)=1,"record"," records") & ")"
(This may seem a strange thing to want to do, but i don't want the users to see the navigation buttons.)
 
This code uses a Label (named lblRecNo) on the Form to display the info you want, but in a different manner.


Private Sub Form_Current()
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
rst.MoveLast
With rst
rst.Bookmark = Me.Bookmark
Me.lblRecNo.Caption = (rst.AbsolutePosition + 1) & " of " & rst.RecordCount
End With
End Sub

PaulF
 
Hi PaulF

I'm sorry that doesn't seem to work, i get this message

Compile error:
User-defined type not defined

is it something i've done??
 
You should tell us what variable gave you that error. I might assume you are using Access 2000 and it is the Dim rst As DAO.Recordset. This would be because you have not set the reference to the DAO Compatability Library 3.5. Open a module and go to tools\references. Find the correct reference, check it and return to the module.

Steve King Growth follows a healthy professional curiosity
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top