Jeff said:
When I try to run reports or the associated query I get a
pop-up screen telling me "divison by zero" and it won't
produce the report. Help!
You cannot divide by zero. As a workaround, save the following function in a
modules and wrap it around all your divisions done in queries:
Public Function SafeDiv(Numerator As Variant, Denominator As Variant)
'--------------------------------------------------------------------
' Name: SafeDiv
' Purpose: Division by Zero handler
' Inputs: Numerator As Variant
' Denominator As Variant
' Author: Arvin Meyer
' Date: March 25, 1999
'--------------------------------------------------------------------
On Error GoTo Err_SafeDiv
If Not (IsNumeric(Numerator) And IsNumeric(Denominator)) Then
SafeDiv = Null
ElseIf Denominator = 0 Then
SafeDiv = 0
Else
SafeDiv = Numerator / Denominator
End If
Exit_SafeDiv:
Exit Function
Err_SafeDiv:
Select Case Err
Case 0
Case Else
MsgBox Err.Description
Resume Exit_SafeDiv
End Select
End Function
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access