how do multiply values in one field

S

sewer rat

i am tring to calculate a geometric mean in a report that is made from a
query. the calculation in excel would look like this
(a*b*nth....)^(1/nth)
 
T

Tom Wickerath

You can call the geometric mean function in Excel, which is easier than
writing a custom function. See the following KB article:

How to call Excel functions from within Access 2000
http://support.microsoft.com/?id=198571

These samples use early binding, so they require that a reference by checked
for the "Microsoft Excel X.X Object Library", where X.X is the version number
(9.0 for Office 2000, 10.0 for Office 2002 and 11.0 for Office 2003). You can
also use late binding, which will free your code of version specific
references.

The following early bound code example works in Access, after setting a
reference to Excel:

Option Compare Database
Option Explicit

Sub xlGeoMean()
On Error GoTo ProcError

Dim objExcel As Excel.Application
Set objExcel = CreateObject("Excel.Application")

MsgBox objExcel.Application.GeoMean(4, 5, 8, 7, 11, 4, 3)


ExitProc:
' Cleanup
On Error Resume Next
objExcel.Quit
Set objExcel = Nothing
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in procedure xlGeoMean..."
Resume ExitProc
End Sub


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

i am tring to calculate a geometric mean in a report that is made from a
query. the calculation in excel would look like this
(a*b*nth....)^(1/nth)
 
Top