Link to home
Start Free TrialLog in
Avatar of etech0
etech0Flag for United States of America

asked on

access display number of record in form (not ID)

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?
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

In the form_current event procedure for the subform use the code...


Me.yourtextboxname = "Showing Record " & Me.Recordset.AbsolutePosition + 1 & " of  " & Me.Recordset.RecordCount
Avatar of etech0

ASKER

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

ASKER CERTIFIED SOLUTION
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of etech0

ASKER

That works great! Thanks.