?
Solved

access display number of record in form (not ID)

Posted on 2012-03-26
4
Medium Priority
?
308 Views
Last Modified: 2012-03-26
Hi!
I have an access subform that displays a datasheet view list of comments. Is there a way to extract the number of the currently selected comment? I can't use ID, because there are many more comments, and the table is filtered to only show comments that are linked to the currently selected taskID in the parent form. I want the extracted number to also take into account the way the form is sorted, with most recent comments on top.
(The reason I want this is to have a textbox that shows "showing comment x of total")
Can this be done?
0
Comment
Question by:etech0
  • 2
  • 2
4 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 37766148
In the form_current event procedure for the subform use the code...


Me.yourtextboxname = "Showing Record " & Me.Recordset.AbsolutePosition + 1 & " of  " & Me.Recordset.RecordCount
0
 
LVL 10

Author Comment

by:etech0
ID: 37766651
Thanks for your response. However, when the code runs, I get an "Object doesn't support this property or method" error.

Here is my code, modified to apply to my parent and sub form, and run from a module:
Forms!catwebwork2f.CommentNum = "Showing Comment " & MForms!catwebwork2f.CatWebWork2CommentsSummaryF.Recordset.AbsolutePosition + 1 & " of  " & Forms!catwebwork2f.CatWebWork2CommentsSummaryF.Recordset.RecordCount

Open in new window

0
 
LVL 77

Accepted Solution

by:
peter57r earned 2000 total points
ID: 37766737
Forms!catwebwork2f.CommentNum = "Showing Comment "
 & MForms!catwebwork2f.CatWebWork2CommentsSummaryF.Recordset.AbsolutePosition + 1
 &
 " of  " &
 Forms!catwebwork2f.CatWebWork2CommentsSummaryF.Recordset.RecordCount

You have an extra M in front of Forms which should be removed.
You also need an object reference to the form as in...

Forms!catwebwork2f.CatWebWork2CommentsSummaryF.Form.Recordset  .......etc
0
 
LVL 10

Author Closing Comment

by:etech0
ID: 37766787
That works great! Thanks.
0

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question