Hi,
I have a function called RMax that obtains the MAXIMUM value of several fields in a table. I use this value in a query then a report is based on this query. The formula for one field is: [Total]/[RMax].
Since the maximum value is sometimes 0 , the total becomes a # ERROR in the report. This is okay when viewing it in access, but I get an error when exporting this report to an excel spreadsheet.
Is there a way around this so that the # ERROR doesn't show on the report? My function is below:
-------------------------
Function RMax(ParamArray FieldValues()) As Variant
Dim lngMax As Double
Dim varArg As Variant
lngMax = 0
For Each varArg In FieldValues
If varArg > lngMax Then
lngMax = varArg
End If
Next
RMax = lngMax
End Function
Thanks again!
TN
I have a function called RMax that obtains the MAXIMUM value of several fields in a table. I use this value in a query then a report is based on this query. The formula for one field is: [Total]/[RMax].
Since the maximum value is sometimes 0 , the total becomes a # ERROR in the report. This is okay when viewing it in access, but I get an error when exporting this report to an excel spreadsheet.
Is there a way around this so that the # ERROR doesn't show on the report? My function is below:
-------------------------
Function RMax(ParamArray FieldValues()) As Variant
Dim lngMax As Double
Dim varArg As Variant
lngMax = 0
For Each varArg In FieldValues
If varArg > lngMax Then
lngMax = varArg
End If
Next
RMax = lngMax
End Function
Thanks again!
TN