Count records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to count the records in a subform but only to count the records on
that form where specific criteria is met on one of the fields. Hope this
makes sense???
 
Please could you point me in the right direction on how to do this as I have
not used many functions before in access.
 
Dear Chester1,

I know nothing about your form !!,but I'll try to help you as much as possible
create a text box on the main form and write the following function in the
Controlsource property:

=DCount("*", "[tablename]", "[field] = 'Chester' and [time] = #09:00#
And [Date] = #" & txtDate & "#")

Assuming that :
Tablename = the name of the table
field= the name of the field that you'd like to count
'Chester' =the specific data that you'd like to count
time=the name of a field that contains a time value

Then create a text box on the subform to refer to the one that you created
on the main form ,it can be like this :on the event 'OnCurrent' and write
this function:
[Forms]![Formname].[Form].[textbox1]=[text box2]
Assuming that : Formname= form name
textbox1= the name of the text box on the subform
textbox2= the name of the text box on the main form
 
I noticed this post and I have written a database for the HR department where
I work to track job applicants. I have a main table that contains the
specific application info and a table that contains the applicant demographic
info. There is a main form with the applicant demo info on it and that form
contains a subform with the info pertaining to the specific application that
was submitted. Some applicants have applied more that once so I would like to
have a textbox on the main form which at a glance will show how many times a
person has applied with us. The two forms are linked with an applicant ID
number. In the demographics table, the ID number is the primary key. In the
applicant table, there can be multiple instances of a specific applicant ID.
When I use the dcount function in the form load event of the main form, I get
an error in the statement. Is there a way to pass the number of times a
person has applied to a global variable and have a text box on the main form
receive this value?

Pietro said:
Dear Chester1,

I know nothing about your form !!,but I'll try to help you as much as possible
create a text box on the main form and write the following function in the
Controlsource property:

=DCount("*", "[tablename]", "[field] = 'Chester' and [time] = #09:00#
And [Date] = #" & txtDate & "#")

Assuming that :
Tablename = the name of the table
field= the name of the field that you'd like to count
'Chester' =the specific data that you'd like to count
time=the name of a field that contains a time value

Then create a text box on the subform to refer to the one that you created
on the main form ,it can be like this :on the event 'OnCurrent' and write
this function:
[Forms]![Formname].[Form].[textbox1]=[text box2]
Assuming that : Formname= form name
textbox1= the name of the text box on the subform
textbox2= the name of the text box on the main form




Chester1 said:
Please could you point me in the right direction on how to do this as I have
not used many functions before in access.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top