# Thread: Help with a simple function!

1. Registered User
Join Date
Dec 2011
Posts
25

## Unanswered: Help with a simple function!

Bare with me, as I am BRAND new to access.
I have two forms. the one form shows CourseID, CourseTitle,EmployeeCourseID,Year,Grade(%),Qualifi ed.

Grade(%): Sum([Results].[Score]/[Module].[Maximum Points]*[Module].[PercentofGrade]). < which gives the overall grade. now I am wondering if there is some sort of expression or function I can use in that function to say, differenciate the Year ( 2011, 2012, 2013) so when I add in another score for the courses in 2012, it doesnt add on to the already existing years(2011), which it has been doing.

Join Date
Nov 2004
Location
out on a limb
Posts
13,692
put an additinal parameter to contain the year
and only retrieve data for that year
as an option make the parameter optional and if not supplied use all years value

3. Registered User
Join Date
Dec 2011
Posts
25
Unfortunatly, ALL years have to be shown on the form.

Could it not be a possible function to add into that calculation? or maybe create a new one based on the actual grade(%)?

Thanks so much!

Join Date
Nov 2004
Location
out on a limb
Posts
13,692
sorry I suspect you are thinking in spreadsheet mode
write a function which calculates the grade (extracting what ever data it needs, or supply whatever data it needs) the fucntikn returns the grade for the specified values

if the function is designed as a generic then it can be used whereever you need to calculate the grade.

5. Registered User
Join Date
Dec 2011
Posts
25
Okay! So would that function be used in the query with the grade(%) calculation function? or? I apologize I am very new to this. and the =Calcgrade(thisyear) function , is the actual function to be used? I guess I know what I need to do but I do not know HOW to do it.

Thanks a bunch

Join Date
Nov 2004
Location
out on a limb
Posts
13,692
calcgrade was intended to be a user written function to calculate the grade

how you write it, how you deploy it depends entirely in the table design

7. Registered User
Join Date
Dec 2011
Posts
25
I appreciate your help. I just cant seem to figure this one out, as I am not familiar at all with codes, and functions.

I dont mean to press my luck, but is there any way I could send you any information you need in order to write a function for me? ( without sending the dbase, as it is confidental)

Join Date
Nov 2004
Location
out on a limb
Posts
13,692