how to Count specific field in a table with a condition?

A

A.Farsinejad

I have two tables "problems" and "cases". I also design a form for each of
them. in my problem form there is a field which is "number of cases" that
should be the number of occurance of the problem which is submitted in
"cases" table.

I don't know how I can calculate the number of cases happened and show in
"problems" form. I should mention that I define the relationship between
these two tables based on "problem number" in "problems" table and "number in
problem" in " cases" table.

I also use the data source in my "problems" form for the field" number of
cases" with expressions like:
if(cases.[number in problems]=problems.[problem number], count(cases.[case
number],0)
but the field shows "#name?" which means it can not be recognized by the
system.
Is anybody there who can help me on this issue?
 
B

Bob Quintal

I have two tables "problems" and "cases". I also design a form for
each of them. in my problem form there is a field which is "number
of cases" that should be the number of occurance of the problem
which is submitted in "cases" table.

I don't know how I can calculate the number of cases happened and
show in "problems" form. I should mention that I define the
relationship between these two tables based on "problem number" in
"problems" table and "number in problem" in " cases" table.

I also use the data source in my "problems" form for the field"
number of cases" with expressions like:
if(cases.[number in problems]=problems.[problem number],
count(cases.[case number],0)
but the field shows "#name?" which means it can not be recognized
by the system.
Is anybody there who can help me on this issue?

In a form's controlsource, as calculated field starts with the =
sign.
To count your number of cases
=dCount("*", "Cases","[number in problem] =" & forms!problems![case
number]
 

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

Top