calculations in forms

jamesgonzo

Registered User.
Local time
Today, 08:12
Joined
Jun 1, 2003
Messages
12
I have a database where I am trying to average my students grades. I have added a textbox in the form but I am unable to get the right expression to average the 2 grades. What usually happens is the 2 numbers are combined side by side. For example, if the grades were a 50 and a 50, the text box would show 5050. Please help, I hope what I'm trying to do is possible.
THANKS
 
I had a similar issue and didn't manage to get the AVG function to work the way I wanted.

Instead I used =([field1]+[field2])/2

Not perfect but it works...
 
Believe it or not, Access doesn't really have an "average" function like the one in Excel. It does have the SQL Aggregregate Avg function, but it's meant to be used in SQL statements, not in calculated controls. Best to use andrewf10's solution, or if you need more flexibility, write your own Average function in VBA or call the Average function from Excel using Automation. Another alternative is the Davg function, if you can get it to work in your situation.
 
Last edited:
GOT IT

After even more trying I was finally able to get it. I ended up using the expression of =[field 1]/2 + [field 2]/2. It works perfectly. So if you ever have to avg. even more numbers, you just divide each field by the number of fields you need to average.
THANKS FOR EVERYONES REPLIES.
 

Users who are viewing this thread

Back
Top Bottom