UT97: "Overflow" or "Division by Zero" Error Upsizing Table (165827)
The information in this article applies to:
- Microsoft Access Upsizing Tools 97
This article was previously published under Q165827 Advanced: Requires expert coding, interoperability, and multiuser skills.
SYMPTOMS
When you use the Microsoft Access 97 Upsizing Tools to export a table to
Microsoft SQL Server, you receive one of the following errors when you try
to export a large table with few or no records:
Overflow
Division by zero
This article assumes that you are familiar with Visual Basic for
Applications and with creating Microsoft Access applications using the
programming tools provided with Microsoft Access. For more information
about Visual Basic for Applications, please refer to your version of the
"Building Applications with Microsoft Access" manual.
RESOLUTION
You must add error handling to the UT_ComputeLocksNeeded procedure in the
Upsizing Wizard database. The extra code sets the number of locks needed to
0 when the number of records in the table is small and the number of fields
in the table is large:
- Start Microsoft Access 97 and open the Upsizing Wizard database, Wzcs97.mda. This database is installed by default in the \Program Files\Microsoft Office\Office folder.
NOTE: If you have already used the Upsizing Wizard in the current
session of Microsoft Access, you must quit and restart Microsoft Access
before you can open the Wizard database.
- Open the UT_modUpsizerMain module in Design view.
- Add code to the UT_ComputeLocksNeeded procedure so it looks like the
following. Note that the four lines you need to add are commented to
make them easier to see:
'-------------------------------------------------------------------
' UT_ComputeLocksNeeded
'
' Computes the number of SQL Server locks needed to upsize a given
' table. The formula used is:
'
' r / (p \ s)
'
' where:
' s = max record size (we don't average text fields)
' p = SQL Server page size less overhead
' r = number of records in the table
'-------------------------------------------------------------------
Function UT_ComputeLocksNeeded(tdf As TableDef) As Long
On Error GoTo Error_out ' Add this line.
Dim fld As Field
Dim lngRecSize As Long
Dim intBytesPerPage As Integer
' Get record size.
For Each fld In tdf.Fields
lngRecSize = lngRecSize + fld.Size
Next
' Get bytes available per page.
intBytesPerPage = UT_SQL_PAGE_SIZE - UT_SQL_PAGE_OVERHEAD
' Compute number of pages, and thus locks, needed.
UT_ComputeLocksNeeded = tdf.RecordCount / (intBytesPerPage \ _
lngRecSize)
Exit Function ' Add this line.
Error_out: ' Add this line.
UT_ComputeLocksNeeded = 0 ' Add this line.
End Function
- Save the UT_modUpsizerMain module.
- On the Debug menu, click "Compile and Save All Modules."
- Close the UT_modUpsizerMain module and the Wzcs97 database.
- Open your database and upsize your table.
STATUS
Microsoft has confirmed this to be a problem in Microsoft Access Upsizing
Tools 97.
REFERENCES
You can download the Microsoft Access Upsizing Wizard 97 free of charge
from the Microsoft Access Developer Forum Web site at the following
address:
Click the link to Microsoft Access Upsizing Tools 97 to download and
install the wizard. For additional information another problem that could cause the Overflow error message, click the article number below
to view the article in the Microsoft Knowledge Base:
279454 ACC97: "Overflow" Error Message When You Try to Upsize to SQL Server 2000
Modification Type: | Major | Last Reviewed: | 7/16/2002 |
---|
Keywords: | kberrmsg kbother kbprb KB165827 |
---|
|