Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

access display number of record in form (not ID)

Posted on 2012-03-26
4
Medium Priority
?
306 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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

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.
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

618 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