Record Count (1 Viewer)

stu_c

Registered User.
Local time
Today, 05:01
Joined
Sep 20, 2007
Messages
489
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
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 21:01
Joined
Oct 29, 2018
Messages
21,446
Hi. Try.
Code:
=[SFRMItems].[Form].Recordset.RecordCount
Hope it helps..
 

stu_c

Registered User.
Local time
Today, 05:01
Joined
Sep 20, 2007
Messages
489
Hi. Try.
Code:
=[SFRMItems].[Form].Recordset.RecordCount
Hope it helps..

no that didn't work :(
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 21:01
Joined
Oct 29, 2018
Messages
21,446
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.
 

stu_c

Registered User.
Local time
Today, 05:01
Joined
Sep 20, 2007
Messages
489
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
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 21:01
Joined
Oct 29, 2018
Messages
21,446
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?
 

stu_c

Registered User.
Local time
Today, 05:01
Joined
Sep 20, 2007
Messages
489
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
 

Attachments

  • TestDatabase1.accdb
    640 KB · Views: 91

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 21:01
Joined
Oct 29, 2018
Messages
21,446
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.
 

Attachments

  • TestDatabase1.accdb
    640 KB · Views: 93
Last edited:

stu_c

Registered User.
Local time
Today, 05:01
Joined
Sep 20, 2007
Messages
489
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]
 

Users who are viewing this thread

Top Bottom