ACC97: Manipulating Objects with DAO May Cause Database BloatLast reviewed: August 5, 1997Article ID: Q172285 |
The information in this article applies to:
SYMPTOMSAdvanced: Requires expert coding, interoperability, and multiuser skills. When you use data access objects (DAO) to create objects in a database, the size of the database increases substantially during the operation. After compacting, the size of the database is much smaller. 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 the "Building Applications with Microsoft Access 97" manual.
RESOLUTIONUse SQL Data Definition Language (DDL) statements rather than DAO to create or modify database objects. For example, you can use the following procedure to work around the behavior demonstrated in the "Steps to Reproduce Problem" section:
Sub CreateTables() Dim db As Database Dim sql As String Dim i As Integer, j As Integer Set db = CurrentDb() For i = 1 To 20 sql = "CREATE TABLE Table" & i & " (" For j = 1 To 200 sql = sql & "Field" & j & " TEXT," Next sql = Left$(sql, Len(sql) - 1) & ");" db.Execute sql Next Application.RefreshDatabaseWindow End Sub STATUSMicrosoft has confirmed this to be a problem in Microsoft Access 97. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATIONThis behavior typically occurs when using DAO to create or modify a large number of database objects. The following example demonstrates this by using DAO to create twenty tables, each with two hundred fields. In this example, reducing the number of fields created in the example greatly reduces the amount of database bloat.
Steps to Reproduce Problem
REFERENCESFor more information about DDL queries, search the Help Index for "data-definition queries," or ask the Microsoft Access 97 Office Assistant. Keywords : MdlDao kbusage Version : 97 Platform : WINDOWS Hardware : x86 Issue type : kbbug Solution Type : kbcode |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |