Problem with form?

M

mj23449

I created a database for the school I work for that tracks
student test scores and calculates some important averages
that are reported back to the state. The problem is that
I have 6 fields that are different subject areas and each
student is tested in these 6 areas. The tests are
administered one at a time through out the school year.
At the bottom of the form the teacher wants a box that
calculates on the fly as shes entering in scores the
average of those scores. The catch is though that the
average only consists of the six numbers for test scores.
The problem that I'm having though is that either the box
where the calculation goes only averages the score for 1
box, but for every entry in that box every time its
modified which is not what I want or it averages all 6
boxes. The problem with that is that say only 3 tests
have been taken, then I need the box to calculate only the
3 scores and not all six because all six would give the
student a wrong percentage. Is there a way to get access
to do what I need it to do? The stuff i've tried so far
either doesn't work or it calculates the incorrect
average. Any help will be greatly appreciated.
 
N

Nikos Yannacopoulos

Have a look at my answer to the following posting:
calculating average on the form. Jan 12 2004 9:44PM
in the Access General nwesgroup. I believe it'll help you.
Also: use the on change event of all six text boxes for score input to fire
either the code or the macro that sets the value of the average.

HTH,
Nikos
 
G

Guest

-----Original Message-----
Have a look at my answer to the following posting:
calculating average on the form. Jan 12 2004 9:44PM
in the Access General nwesgroup. I believe it'll help you.
Also: use the on change event of all six text boxes for score input to fire
either the code or the macro that sets the value of the average.

HTH,
Nikos




.
Thanks for the solution I'll give it a shot. I just a
couple of quick questions. In the VB code you have "text"
in there a few times. I'm not to familiar with VB so
is "text" something I need to change or does it need to
stay just like it is. Also will this solution calculation
the average on individual records. So lets say I
calculate one form record then when I go to the next
record will it calculate the average based on whats in
those fields for the record. Thanks again for the help.
 
N

Nikos Yannacopoulos

Jeff,

Your first question:
The sample code assumes that your input text boxes are named Text1,
Text2,... Text6 in your form.
You can call them anything else as long as you stick with a standard prefix
and a sequential number. For instance, you could call them Input1, Input2
etc, in which case you substitute Text with Input in the code.
The trick is this: < "Text" & i > in the code concatenates the string Text
(or whatever you use) with the current value of i, so as to reference one
control in each loop.

You have six input controls, so the loop start line for you is

For i = 1 to 6

You could also call the input controls, say, Text37 through Text42, you
would just have to change the loop start to:

For i = 37 to 42

or you could call them Text0, Text2, Text4, Text6, Text8, Text10 and change
the loop start to:

For i = 0 to 10 step 2

Get the idea?

Your second question: yes, it will calculate sums and averages for each
indivisual record.

Regards,
Nikos
 

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