count gender and fill male female field (1 Viewer)

schemadyn

New member
Local time
Today, 21:53
Joined
Oct 21, 2019
Messages
6
I would like to count the gender in the subform datasheet and fill the male female fields in main form. How do I do that? Thank you.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:53
Joined
Oct 29, 2018
Messages
21,358
Hi. Is the subform filtered? If not, you could try using DCount().
 

schemadyn

New member
Local time
Today, 21:53
Joined
Oct 21, 2019
Messages
6
Thank you theDBguy. May I share the DB with you here so that we can discuss?
 

schemadyn

New member
Local time
Today, 21:53
Joined
Oct 21, 2019
Messages
6
@theDBguy, please download attached file for your kind reference.

What I wanted to achieve is in the EventParticipants form after adding the records in the Event Participants subform, the fields 9.a) and 9.b) will be auto filled based on the counts in the subform and be stored in the Events table.

How do I achieve this? Thank you for your help.
 

Attachments

  • ECTAD_EVENTS_DATA_Entry.zip
    1.1 MB · Views: 101

theDBguy

I’m here to help
Staff member
Local time
Today, 07:53
Joined
Oct 29, 2018
Messages
21,358
@theDBguy, please download attached file for your kind reference.

What I wanted to achieve is in the EventParticipants form after adding the records in the Event Participants subform, the fields 9.a) and 9.b) will be auto filled based on the counts in the subform and be stored in the Events table.

How do I achieve this? Thank you for your help.
Ah, before I do that, I would like to mention that storing calculated values is against normalization rules, so we tend to recommend not doing it.
 

schemadyn

New member
Local time
Today, 21:53
Joined
Oct 21, 2019
Messages
6
Got your point. The intention to have this was to lower chances of error of leaving 9.a and 9.b fields as blanks if entered manually like it is now.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:53
Joined
Oct 29, 2018
Messages
21,358
Got your point. The intention to have this was to lower chances of error of leaving 9.a and 9.b fields as blanks if entered manually like it is now.
The "correct" way to avoid the error is to "not let any user manually enter anything." Since the value can be calculated, it should just be calculated anytime you need it. To do this, you can use a query for your form or report where you can include a calculated column, so you can display the accurate information to the user.
 

schemadyn

New member
Local time
Today, 21:53
Joined
Oct 21, 2019
Messages
6
How? Sorry for my question but I am a novice in this field
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:53
Joined
Oct 29, 2018
Messages
21,358
How? Sorry for my question but I am a novice in this field
Hi. I'm glad you asked. Please check out the attached modified version of your db.
 

Attachments

  • ECTAD_EVENTS_DATA_Entry.zip
    411 KB · Views: 110

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:53
Joined
May 7, 2009
Messages
19,169
while this one will update your table.
see the current event of the main form.
see the afterupdate event of the subform.
 

Attachments

  • ECTAD_EVENTS_DATA_Entry.zip
    396.3 KB · Views: 94

schemadyn

New member
Local time
Today, 21:53
Joined
Oct 21, 2019
Messages
6
@theDBguy, much appreciated. thank you for your guidance. Now have solved as we wanted. Thank you.

@arenlgp, thank you very much for a different approach to the problem.

Thank you very much to both of you :)
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:53
Joined
Oct 29, 2018
Messages
21,358
@theDBguy, much appreciated. thank you for your guidance. Now have solved as we wanted. Thank you.

@arenlgp, thank you very much for a different approach to the problem.

Thank you very much to both of you :)
Hi. You're very welcome. Arnel and I were happy to assist. Good luck with your project.
 

Users who are viewing this thread

Top Bottom