UT97: "Overflow" or "Division by zero" Error Upsizing TableID: Q165827
|
Advanced: Requires expert coding, interoperability, and multiuser skills.
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
-or-
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.Division by zero
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:
'-------------------------------------------------------------------
' 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
Microsoft has confirmed this to be a problem in Microsoft Access Upsizing Tools 97.
Function MakeUpsizeTable()
Dim db As Database
Dim td As TableDef
Dim fd As Field
Dim i As Integer
Set db = CurrentDb
Set td = db.CreateTableDef("tblUpsizeTable")
For i = 1 to 100
Set fd = td.CreateField("Field" & i, dbText, 50)
td.Fields.Append fd
Next i
db.TableDefs.Append td
RefreshDatabaseWindow
Msgbox "Table Created."
End Function
?MakeUpsizeTable
You can download the Microsoft Access Upsizing Wizard 97 free of charge from the Microsoft Access Developer Forum Web site at the following address:
http://www.microsoft.com/Accessdev/a-free.htmClick the link to Microsoft Access Upsizing Tools 97 to download and install the wizard.
Additional query words: uw divide
Keywords : kberrmsg kbother WzProb WzOthr AutPrb
Version :
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: July 21, 1999