Counting

J

Jacob Frankham

Hi

I have 2 fields in my query

eg studentID and modules (these are ficticious names for simplicity !)

studentID is unique, but there may be several instances of the same module
for each studentID

I have a report which is grouping by studentID

I wish to have a textbox which counts all of the UNIQUE module names for
each studentID

I have been using Count([studentID]) but this returns the total number of
records for that studentID - I wish to see only the total number of
DIFFERENT values of modules

eg

l914458 Chemistry
Chemistry
Chemistry
Physics
Physics

I wish to see '2', not '5'

Many thanks

J
 
A

Andy C

Hi,

Insert a "module name" header and footer inside the
Student ID Header in your report. Place the count function
in the module name footer. Set the "running Sum" property
for the count field to "No".
This will give you a count for each module name.

regards,
Andy.
 
G

Guest

whoops, misread your initial mail a bit. In the "module
name" footer use the AVG function."=AVG(module_name)" This
will return for example "1" for chemistry, and "1" for
physics.
Then use the SUM function to add up the two different
values and this will return "2". "=SUM(the above textbox
name)"

Hope that helps you more.
-----Original Message-----

Hi,

Insert a "module name" header and footer inside the
Student ID Header in your report. Place the count function
in the module name footer. Set the "running Sum" property
for the count field to "No".
This will give you a count for each module name.

regards,
Andy.
-----Original Message-----
Hi

I have 2 fields in my query

eg studentID and modules (these are ficticious names for simplicity !)

studentID is unique, but there may be several instances of the same module
for each studentID

I have a report which is grouping by studentID

I wish to have a textbox which counts all of the UNIQUE module names for
each studentID

I have been using Count([studentID]) but this returns
the
total number of
records for that studentID - I wish to see only the
total
number of
DIFFERENT values of modules

eg

l914458 Chemistry
Chemistry
Chemistry
Physics
Physics

I wish to see '2', not '5'

Many thanks

J


.
.
 
J

Jacob Frankham

Hi there

Thanks for that

BUT......

It states a data type mismatch - does AVG not apply just to numbers?

Cheers

J
whoops, misread your initial mail a bit. In the "module
name" footer use the AVG function."=AVG(module_name)" This
will return for example "1" for chemistry, and "1" for
physics.
Then use the SUM function to add up the two different
values and this will return "2". "=SUM(the above textbox
name)"

Hope that helps you more.
-----Original Message-----

Hi,

Insert a "module name" header and footer inside the
Student ID Header in your report. Place the count function
in the module name footer. Set the "running Sum" property
for the count field to "No".
This will give you a count for each module name.

regards,
Andy.
-----Original Message-----
Hi

I have 2 fields in my query

eg studentID and modules (these are ficticious names for simplicity !)

studentID is unique, but there may be several instances of the same module
for each studentID

I have a report which is grouping by studentID

I wish to have a textbox which counts all of the UNIQUE module names for
each studentID

I have been using Count([studentID]) but this returns
the
total number of
records for that studentID - I wish to see only the
total
number of
DIFFERENT values of modules

eg

l914458 Chemistry
Chemistry
Chemistry
Physics
Physics

I wish to see '2', not '5'

Many thanks

J


.
.
 

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

Similar Threads

Counting - can anyone clarify? 5
calculate rank 3
Missing attendance records (Wizard won't help) 3
Relationships and Keys 18
Averages 3
Update query using counts. 2
Counting Records in a report 1
Dsum Syntax Problem 1

Top