[AccessD] Function vs Sub

Klos, Susan Susan.Klos at fldoe.org
Thu Feb 13 11:05:00 CST 2003


I hope John doesn't mind but I have had a similar question and would like
some clarification.  From what folks have said, I would guess if I wanted to
return a percentage of a count of records, I would use a function.  Right?
Would I write a function for each percentage I wanted?  i.e. I want to get
the percentage of all elegible students who attained a grade of c or better
on the test.  Suppose I want to break this down further and get a percentage
of all elegible students who made a grade of c or better on the reading
test, the same for the math test, and the percentage of (students who
attained a score of >=3 plus students who attained a score of >=3.5) on the
writing test.  Would these be three different functions?  If so, and once I
have the functions created (and that is a big once as I am not sure how to
go about writing the functions in the first place) how or where do I call
these functions to get the results laid out in a grid so I can export them
to Excel.

-----Original Message-----
From: Susan Harkins [mailto:harkins at iglou.com]
Sent: Thursday, February 13, 2003 11:41 AM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Function vs Sub




> I recently smartened up and started using fuctions in my code, and I've
> got what may be a very dumb question...should I be using "functions" or
> should they be "Public Subs" or ?????? What is the difference. I
> apologize if I am lowering the intelligence quota today, but I just
> haven't come across this and I don't want to go down the wrong path.

==========Generally, a sub executes a task and a function returns a value --
theoretically. This is another one of those "you're wrong if you don't do it
like me" arguments. The truth is, Access doesn't really care.

I use subs only for event procedures and I use functions elsewhere. I manage
to deflect the arrows okay... ;)

Susan H.

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list