?
Solved

access display number of record in form (not ID)

Posted on 2012-03-26
4
Medium Priority
?
297 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Suggested Courses

800 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