ACC2000: Manipulating Objects with ADO May Cause Database Bloat (199005)
The information in this article applies to:
This article was previously published under Q199005 Advanced: Requires expert coding, interoperability, and multiuser skills.
SYMPTOMS
When you use ActiveX Data Objects (ADO) 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.
RESOLUTION
Use SQL Data-Definition Language (DDL) statements rather than ADO 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 later in this article: 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.
Sub CreateTables()
Dim ADOCon As New ADODB.Connection
Dim ADOCmd As New ADODB.Command
Dim MyStr As String
Dim i As Integer, j As Integer
' Use active Access connection.
Set ADOCon = CurrentProject.Connection
For i = 1 To 20
ADOCon.Execute "CREATE TABLE tblTest" & i
For j = 1 To 200
ADOCon.Execute "ALTER TABLE tblTest" _
& i & " ADD Field" & j & " Text"
Next
Next
Application.RefreshDatabaseWindow
End Sub
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. REFERENCESFor more information about data-definition queries, click Microsoft Access Help on the Help menu, type work with tables or indexes by using an SQL data-definition query in the Office Assistant or the Answer Wizard, and then click Search to view the topic.
Modification Type: | Major | Last Reviewed: | 6/23/2005 |
---|
Keywords: | kbbug kbnofix kbusage KB199005 |
---|
|