ACC97: "Division by Zero" Error Using Publish To The Web Wizard

ID: Q178886


The information in this article applies to:
  • Microsoft Access 97


SYMPTOMS

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

After you set the ScaleMode property in a report to 5 or to 7 and try to publish the report as HTML by using the "Publish to the Web Wizard," the wizard may fail, and you may receive the following error message:

Division by Zero.


CAUSE

This behavior occurs if the following conditions are true:

  • The ScaleMode property of any of the following sections is set to 5 or to 7:

    • Report Header or Footer


    • Page Header or Footer


    • Group Header or Footer




  • The following types of controls are in the sections:

    • Labels


    • Text boxes


    • Combo boxes


    • List boxes


    • Option buttons


    • Option groups


    • Check boxes


    • Bound object Frames


    • Subreports





RESOLUTION

The ScaleMode property, in conjunction with the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties are generally used to create custom coordinate systems for purposes of drawing or changing the size of objects on a report or form.

If it is necessary to use inches or centimeters as a scale, you can do so by setting the ScaleMode property to 1 (Twips), and then using the following conversions to arrive at an equivalent setting in inches or centimeters:

  • 1440 Twips equals one logical inch


  • 567 Twips equals one logical centimeter


How to Use the ScaleMode Property

The following steps illustrate how you can draw two circles that appear as though they are the same size even though a different ScaleMode property is used with each one:
  1. In Microsoft Access 97, open a new blank database.


  2. In the Database window, click the Reports tab.


  3. Click New to create a report in Design view. Do not select a table or query to base the report on. Click OK.


  4. Using the right mouse button (right-click), click inside the Details section of the report and click Build Event on the shortcut menu.


  5. In the Choose Builder dialog box, click Code Builder, and then click OK.


  6. Type or paste the following event procedure in the Module window:
    
           Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    
              ' Set the ScaleMode property of the Details section to 5 (Inches)
    
              Me.ScaleMode = 5
    
              ' Draw a circle in the Details section with a radius of .25
              ' Inches.
    
              Circle (ScaleWidth / 2, ScaleHeight / 2), 0.25
    
            End Sub 


  7. Close the Module window.


  8. While in Design view of the report, right-click in the Page Footer section. On the shortcut menu, click Build event and type or paste the following procedure:
    
           Private Sub PageFooter_Format(Cancel As Integer, FormatCount As _
           Integer)
    
              ' Set the ScaleMode property of Page Footer section of the report
              ' to 1 (Twips)
    
              Me.ScaleMode = 1
    
              ' Draw a circle in the Details section of the report with a
              ' radius 1 of .25 Inches by multiplying .25 by 1440 which will
              ' return the equivalent of .25 Inches
    
              Circle (ScaleWidth / 2, ScaleHeight / 2), (0.25 * 1440)
    
            End Sub 


  9. Close the Module window and save the report as MyReport.


  10. Open the newly created report by selecting the Reports tab, and then double-clicking MyReport.

    While viewing the report, notice that the circumference of the two circles are the same even though a different ScaleMode setting was used to render each one.



MORE INFORMATION

Steps to Reproduce Behavior


  1. Repeat steps 1-5 in the "How to Use the ScaleMode Property" section.


  2. Type or paste the following event procedure in the Module window:
    
           Private Sub Detail_Format(Cancel As Integer, FormatCount As _
           Integer)
    
              ' Set the ScaleMode property of the Details section to 5 (Inches)
    
              Me.ScaleMode = 5
    
           End Sub 


  3. Save changes and close the Module window.


  4. Add an unbound text box to the Details section of the report.


  5. Save the Report as MyTestReport and close it.


  6. On the File menu, click Save As HTML.


  7. When the "Publish to the Web Wizard" screen appears, click Next.


  8. Click to select the MyTestReport check box.


  9. Click the Finish button.

    Note that you receive the error message mentioned in the "Symptoms section."



REFERENCES

For more information about the ScaleMode property, search the Help Index for "ScaleMode Property," or ask the Microsoft Access 97 Office Assistant.

Additional query words: prb division error divide

Keywords : kberrmsg RptOthr WzProb
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: April 27, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.