I found this function:
Expand|Select|Wrap|Line Numbers
- Function Product(strField As String, strTable As String, _
- Optional strCriteria As String) As Double
- Dim rs As DAO.Recordset
- Dim strSql As String
- Dim dblResult As Double
- 'Build the SQL string.
- strSql = "SELECT " & strField & " FROM " & strTable & _
- " WHERE (" & strField & " Is Not Null) "
- If strCriteria <> vbNullString Then
- strSql = strSql & " AND (" & strCriteria & ")"
- End If
- 'Loop through the recordset.
- Set rs = DBEngine(0)(0).OpenRecordset(strSql & ";")
- If rs.RecordCount > 0 Then
- dblResult = rs(strField)
- rs.MoveNext
- Do While Not rs.EOF
- dblResult = dblResult * rs(strField)
- rs.MoveNext
- Loop
- End If
- rs.Close
- Product = dblResult
- End Function
Expand|Select|Wrap|Line Numbers
- =Product("increase","ppincreases")
"The object doesn't contain the automation object 'product'"
Can someone spot an obvious mistake, or point me in the direction for another alternative? I've found very few and none seem to work.
Thanks
Mandi