If you have records with an Age field and wish to know for a given age, a
parameter, what is the percentage of records having that age, or a lower
one, try:
SELECT COUNT(*) / (SELECT COUNT(*) FROM myTable)
FROM myTable
WHERE age <= [Enter age]
Note that the sub-query, (SELECT COUNT(*) FROM myTable), counts the number
of records, in the whole table, while the main COUNT(*) occurs only on
records satisfying the criteria, WHERE age <= [Enter age].
You can run a VBA function you defined yourself, as long as the function is
declared public and in a standard module (not in a class, not under a form):
SELECT MyVBAFunction( COUNT(*) / (SELECT COUNT(*) FROM myTable) )
FROM myTable
WHERE age <= [Enter age]
assuming your VBA function is defined like:
Public Function MyVBAFunction( Argument AS Double) AS double
...
' return the desired value based on the equation of the curve
' you have in mind
...
MyVBAFunction = value_to_return
End Function
Hoping it may help,
Vanderghast, Access MVP
Steelghost said:
I need help creating a query in MS Access 2007 that will take a determined
value (FC) and run a query against it showing what percentile the value
should fall into based on person's age? Is there also a way to put actual
parameters defining the expected curve within an access database to be
applied toward the initial question.