Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 11-07-2019, 07:24 AM   #1
stu_c
Newly Registered User
 
Join Date: Sep 2007
Posts: 278
Thanks: 7
Thanked 1 Time in 1 Post
stu_c is on a distinguished road
Record Count

Hi all
I have a form with a Tabular sub form but In the main form I want a record count in a TextBox can anyone help me with this?

Main Form - FRMMainDetails
SubForm - SFRMItems
Text Box - TXTNumberOfItems

stu_c is offline   Reply With Quote
Old 11-07-2019, 07:44 AM   #2
theDBguy
I知 here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 5,722
Thanks: 57
Thanked 1,260 Times in 1,241 Posts
theDBguy has a spectacular aura about theDBguy has a spectacular aura about
Re: Record Count

Hi. Try.
Code:
=[SFRMItems].[Form].Recordset.RecordCount
Hope it helps..
__________________
Just my 2 cents...

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.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is online now   Reply With Quote
Old 11-07-2019, 07:58 AM   #3
stu_c
Newly Registered User
 
Join Date: Sep 2007
Posts: 278
Thanks: 7
Thanked 1 Time in 1 Post
stu_c is on a distinguished road
Re: Record Count

Quote:
Originally Posted by theDBguy View Post
Hi. Try.
Code:
=[SFRMItems].[Form].Recordset.RecordCount
Hope it helps..
no that didn't work

stu_c is offline   Reply With Quote
Old 11-07-2019, 08:01 AM   #4
theDBguy
I知 here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 5,722
Thanks: 57
Thanked 1,260 Times in 1,241 Posts
theDBguy has a spectacular aura about theDBguy has a spectacular aura about
Re: Record Count

Quote:
Originally Posted by stu_c View Post
no that didn't work
What did you get? #Name?
__________________
Just my 2 cents...

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.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is online now   Reply With Quote
Old 11-07-2019, 08:04 AM   #5
stu_c
Newly Registered User
 
Join Date: Sep 2007
Posts: 278
Thanks: 7
Thanked 1 Time in 1 Post
stu_c is on a distinguished road
Re: Record Count

Yes mate I did
stu_c is offline   Reply With Quote
Old 11-07-2019, 08:07 AM   #6
theDBguy
I知 here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 5,722
Thanks: 57
Thanked 1,260 Times in 1,241 Posts
theDBguy has a spectacular aura about theDBguy has a spectacular aura about
Re: Record Count

Quote:
Originally Posted by stu_c View Post
Yes mate I did
I thought so, that means you may have had a typo, or you didn't give us the name of your subform control. So, the syntax has to be something like this:
Code:
=SubformControlName.Form.Recordset.RecordCount
The subform control name may or may not be the same as the name of the subform it contains. But if you got a Name error, then it's probably different.
__________________
Just my 2 cents...

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.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is online now   Reply With Quote
Old 11-07-2019, 11:48 PM   #7
stu_c
Newly Registered User
 
Join Date: Sep 2007
Posts: 278
Thanks: 7
Thanked 1 Time in 1 Post
stu_c is on a distinguished road
Re: Record Count

Quote:
Originally Posted by theDBguy View Post
I thought so, that means you may have had a typo, or you didn't give us the name of your subform control. So, the syntax has to be something like this:
Code:
=SubformControlName.Form.Recordset.RecordCount
The subform control name may or may not be the same as the name of the subform it contains. But if you got a Name error, then it's probably different.
hi mate
I tried it again and that was the correct name I gave you, not too sure on the issue

stu_c is offline   Reply With Quote
Old 11-08-2019, 05:12 AM   #8
theDBguy
I知 here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 5,722
Thanks: 57
Thanked 1,260 Times in 1,241 Posts
theDBguy has a spectacular aura about theDBguy has a spectacular aura about
Re: Record Count

Quote:
Originally Posted by stu_c View Post
hi mate
I tried it again and that was the correct name I gave you, not too sure on the issue
Can you post a sample copy of your db?
__________________
Just my 2 cents...

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.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is online now   Reply With Quote
Old 11-08-2019, 05:54 AM   #9
stu_c
Newly Registered User
 
Join Date: Sep 2007
Posts: 278
Thanks: 7
Thanked 1 Time in 1 Post
stu_c is on a distinguished road
Re: Record Count

Not my actual Database but an example of it and in the same format, I want the number of items in the main form to count the number of records from the sub form
Attached Files
File Type: accdb TestDatabase1.accdb (640.0 KB, 7 views)
stu_c is offline   Reply With Quote
Old 11-08-2019, 08:03 AM   #10
theDBguy
I知 here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 5,722
Thanks: 57
Thanked 1,260 Times in 1,241 Posts
theDBguy has a spectacular aura about theDBguy has a spectacular aura about
Re: Record Count

Quote:
Originally Posted by stu_c View Post
Not my actual Database but an example of it and in the same format, I want the number of items in the main form to count the number of records from the sub form
Okay, sorry, I guess Recordset is not available in the Control Source anymore. Instead, I gave you a different approach. Please take a look and let me know if you have any questions.
Attached Files
File Type: accdb TestDatabase1.accdb (640.0 KB, 5 views)
__________________
Just my 2 cents...

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.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Last edited by theDBguy; 11-08-2019 at 08:08 AM.
theDBguy is online now   Reply With Quote
Old 11-12-2019, 02:52 AM   #11
stu_c
Newly Registered User
 
Join Date: Sep 2007
Posts: 278
Thanks: 7
Thanked 1 Time in 1 Post
stu_c is on a distinguished road
Re: Record Count

Quote:
Originally Posted by theDBguy View Post
Okay, sorry, I guess Recordset is not available in the Control Source anymore. Instead, I gave you a different approach. Please take a look and let me know if you have any questions.
Afternoon Mate
thank you for the reply, that's kinda what I need but it seems to only update when I move onto another record and back, also is there a way for that value to be saved into the table?

I managed to do it this way cheating I know but still doesn't save to my table

In the Subform (SFRMItems) I have a
text Box named - RecordCount
with this code
Code:
=Count([ItemRecordID])
then in the main form a text back with this
Code:
=[SFRMItems].[Form]![RecordCount]

stu_c is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
current record count and total record count on form joe789 Forms 6 01-29-2016 02:46 AM
Using Count and MIN together to retrieve only MIN record with Count tomitzi Queries 9 08-17-2015 07:41 AM
Record Count Caption & Stopping Next Record If Blank RXX00 General 4 05-31-2011 07:34 AM
Group Count in Access 2007 - not record count richxyz Reports 1 08-12-2010 11:57 PM
Showing Record Count (Not record selectors) on a form Graham T Forms 2 11-05-2001 10:24 AM




All times are GMT -8. The time now is 08:06 AM.


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 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World