By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,495 Members | 1,208 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,495 IT Pros & Developers. It's quick & easy.

Number of Records displayed on a Form

P: 84
When opening a form based on a query or table, the system will display the total number of records at the bottom and provide navigation options. I can add navigation buttons on the form itself but I would also like to add the item count to the body of the form. Can this be done without changing the query or table?
Dec 11 '06 #1
Share this Question
Share on Google+
2 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
When opening a form based on a query or table, the system will display the total number of records at the bottom and provide navigation options. I can add navigation buttons on the form itself but I would also like to add the item count to the body of the form. Can this be done without changing the query or table?
Check out the answer given in this previous thread by ADezii. Could a version of this code provide what you want.

Mary

http://www.thescripts.com/forum/thread575178.html
Dec 11 '06 #2

missinglinq
Expert 2.5K+
P: 3,532
This is much easier than you would think. The example below assigns the values of the current record and the total records to the form caption (Me.Caption) but you can assign it to a lable or a text box or break it up and assign it to two text boxes. If the RecordSource for the form is a Query use this:

Expand|Select|Wrap|Line Numbers
  1.  Private Sub Form_Current()
  2.   Me.Caption = "Record  " & CurrentRecord & "  Of  " &  RecordsetClone.RecordCount & "  Records"
  3.  End Sub
Be sure to scroll and include all of the line in bold above.

If the form is based on a table, you need to use the above code and add this:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.   DoCmd.GoToRecord , , acNext
  3.   DoCmd.GoToRecord , , acFirst
  4. End Sub
Dec 11 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.