Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 07-01-2014, 04:36 AM   #1
rfaircloth
Newly Registered User
 
Join Date: Jun 2014
Posts: 15
Thanks: 1
Thanked 0 Times in 0 Posts
rfaircloth is on a distinguished road
Display Record Count from Subform in Tab

I have a form that contains a number of tabs, each tab then contains a subform. The basic gist is that there are clients and each client chart needs to be audited to make sure that the every clients chart has all of the correct information in it. So if for example, each client needs an initial treatment plan, there would be a tab called Initial Treatment Plan that would contain a subform (continuous form) displaying all of the clients that are missing this information. I would like to display the number of records that are being displayed in each subform in the tab next to the name to make it easier for the auditor to know how many which tabs have content to be updated. For example, if there are 10 clients that are missing their initial treatment plan, the tab would read "Initial Treatment Plan (10)".

I was able to get a total number of rows in datasheet view, but I don't know if there is a way to have that field as a hidden field in continuous form view that can have its value displayed in the tab. Any help would be greatly appreciated!

rfaircloth is offline   Reply With Quote
Old 07-01-2014, 04:56 AM   #2
rfaircloth
Newly Registered User
 
Join Date: Jun 2014
Posts: 15
Thanks: 1
Thanked 0 Times in 0 Posts
rfaircloth is on a distinguished road
Re: Display Record Count from Subform in Tab

I figured out how to get a hidden field on the continuous form that contains the row count. I created a textbox and set its Control Source to "=Count(*)" and it counts the number of records displayed. Now I'm trying to figure out how to put that number in the tab name.
rfaircloth is offline   Reply With Quote
Old 07-01-2014, 05:46 AM   #3
jdraw
Super Moderator
 
jdraw's Avatar
 
Join Date: Jan 2006
Location: Ottawa, Ontario, Canada;West Palm Beach, Florida
Posts: 12,379
Thanks: 103
Thanked 2,058 Times in 2,002 Posts
jdraw is a glorious beacon of light jdraw is a glorious beacon of light jdraw is a glorious beacon of light jdraw is a glorious beacon of light jdraw is a glorious beacon of light
Re: Display Record Count from Subform in Tab

This may be of some help.

__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
jdraw is offline   Reply With Quote
Old 07-01-2014, 06:41 AM   #4
rfaircloth
Newly Registered User
 
Join Date: Jun 2014
Posts: 15
Thanks: 1
Thanked 0 Times in 0 Posts
rfaircloth is on a distinguished road
Re: Display Record Count from Subform in Tab

No go, I am able to name the tab with plan text using the property sheet, but I need to concatenate the field to something like this: "Initial Treatment Plan (" & intFieldValue & ")". I think that it is going to have to be done in VBA code on the back end. I'm thinking something like:

Me.IntTreatmentPlan.Caption = Me.Subform.Textfield.Value

I have used VB script for web programming, but I'm not that familiar with VBA and how to reference things properly, especially since the data that I need has to come from a subform. It looks like I can reference items from the main form when but not from within a subform.
rfaircloth is offline   Reply With Quote
Old 07-01-2014, 03:54 PM   #5
vbaInet
AWF VIP
 
Join Date: Jan 2010
Location: U.K.
Posts: 26,374
Thanks: 0
Thanked 2,423 Times in 2,389 Posts
vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all
Re: Display Record Count from Subform in Tab

Place a hidden textbox on the header or footer section of your form and enter =Count(*) in it. Use this value to add to the caption of the page.
Code:
Me.pageName.Caption = "Initial Treatment Plan (" & Me.txtCount & ")"
You will obviously need to update this count up-to-date so think about including the code in relevant events that will affect the number.
vbaInet is offline   Reply With Quote
Old 07-01-2014, 04:08 PM   #6
rfaircloth
Newly Registered User
 
Join Date: Jun 2014
Posts: 15
Thanks: 1
Thanked 0 Times in 0 Posts
rfaircloth is on a distinguished road
Re: Display Record Count from Subform in Tab

I can't get this to work. My forms and subforms don't seem to be able to see each other's Controls. When I enter the code into the main form it only sees the Tab control and not the hidden field. When I enter the code in the subform it only sees the hidden field and not the Tab control.
rfaircloth is offline   Reply With Quote
Old 07-01-2014, 04:36 PM   #7
vbaInet
AWF VIP
 
Join Date: Jan 2010
Location: U.K.
Posts: 26,374
Thanks: 0
Thanked 2,423 Times in 2,389 Posts
vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all
Re: Display Record Count from Subform in Tab

The textbox should be placed in each subform. Your subform control has a name so you should use it to reference the hidden textbox in this format:
Code:
Me.NameOfPage.Caption = "Initial Treatment Plan" & Me.SubformControlName.txtHidden & ")"
And don't try to reference the tab control, you don't need. Reference the page directly.


vbaInet is offline   Reply With Quote
Reply

Tags
count rows , subforms , tabs

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Question Count records on subform to display in mainform listbox josephbupe General 4 05-25-2010 06:11 AM
subform record count gisler87 Forms 10 03-19-2009 12:07 AM
Double-click on subform record to display record in separate form for better view CoddFish Forms 4 06-16-2003 02:44 AM
Record Count in a subform? ChampionDuy Modules & VBA 7 05-13-2002 07:28 AM
subform record count nelslynn Forms 1 12-12-2001 11:51 AM




All times are GMT -8. The time now is 06:02 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World