View Single Post
  #3  
Old October 2nd, 2004, 10:38 AM
Richard Hollenbeck
external usenet poster
 
Posts: n/a
Default

Thank you, John, for your reply. I need to make a few clarifications.
First, the query under discussion is the StrSQL string in a DAO.RecordSet.
I assign these RecordSets to text boxes all the time. Second, I'm not
trying to add up averages--that would be counter-productive. I probably
misnamed the field. It was actually the calculated/weighted score of an
activity (score*activityWeight*groupWeight). I know I did it wrong. I
probably needed to use a DCount(), in some way, instead. Here's the deal:

I need to add all [current averages] from each student in a course to get
the current grade for that student. I think I should change the name of
[current average] to properly identify it as the weighted score of a
weighted activity inside a weighted group of activities. After that, I
already have a report that does that. For this report, I don't need
individual student names, but the number of students whose scores are higher
than a certain number (92 for example) and increment the total of students
currently receiving the grade of A. Then =82 and 92 would be B, =72 and
82 would be C, etc. I will eventually want to build a bar chart on the
results, indicating a grade distribution for the entire class.

Sorry, John, that my original post was unclear. I think my original
thinking wasn't clear either. I still don't understand the GROUP BY thing
very well. I'd like to be able to group by a field rather than an
expression, and make sums without the constraints required. I am getting a
lot of errors about an expression not being part of some aggregate thing.
Certainly I need to learn a lot more about aggregated queries.

I Need the sum of (what is currently called) [Current Average] by student
and by course where course is the current course. This will give the
student's current semester grade.

Then, all I really need, is the number of them that fall within A,B,C,D, and
F ranges.


"John Spencer (MVP)" wrote in message
...
You can't assign a query to a text box control. You can use the DSUM

function
(although I do wonder about summing averages).

=DSum("[current average]","[qryCourseGradeDistribution]", "Student=" &

[Student])

You may get errors on that depending on whether Student is a number or

text
value and whether or not your qryCourseGradeDistribution has any

parameters.

If Student is a text value then try
=DSum("[current average]","[qryCourseGradeDistribution]", "Student="

Chr(34) &
[Student] & Chr(34))

Richard Hollenbeck wrote:

I think it is the GROUP BY not being equal to anything. I want totals

of
all grades from each student. I don't know what to make studentID equal

to
(studentID=studentID? Of course not).

=(SELECT Sum([qryCourseGradeDistribution].[current average]) FROM
[qryCourseGradeDistribution] GROUP BY
[qryCourseGradeDistribution].[student])

How can I get around this problem? The text box DOES HAVE a unique name
prefixed with"txt".
Thanks.
RH