Solved

access display number of record in form (not ID)

Posted on 2012-03-26
4
256 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 500 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now