Microsoft KB Archive/301672

= ACC97: Overflow or #Div/0! Error Occurs When You Run a Query, Form, or Report =

Article ID: 301672

Article Last Modified on 1/31/2007

-

APPLIES TO


 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q301672



Moderate: Requires basic macro, coding, and interoperability skills.



SYMPTOMS
When you attempt to run a query, a form, or a report, you may receive one of the following error messages:

Overflow

or


 * 1) Div/0!



CAUSE
This issue can occur because under certain circumstances, a division by zero (0) can show the Overflow error or the #Div/0! error in the control. The error can occur in queries or in calculated controls on a form or a report. In many cases the field value of zero is the correct data.



RESOLUTION
To resolve this issue, use an Immediate If (IIF) statement to trap the error:

Assume that Field A is to be divided by a divisor field that can contain a value of zero. To avoid a division by zero, create an expression field that is set up like this:

=IIF([Divisor Field]=0,0,[Field A]/[Divisor Field])

This IIF statement tests the divisor for a value of zero. If the value of the divisor is equal to zero, the statement returns a value of zero without performing the division. If the value of the divisor is not zero, division occurs normally.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

Additional query words: prb

Keywords: kbprb KB301672

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.