ACC: Database Grows Rapidly When You Modify SQL Statements (165823)
The information in this article applies to:
- Microsoft Access 2.0
- Microsoft Access 97
This article was previously published under Q165823 SYMPTOMS
Advanced: Requires expert coding, interoperability, and multiuser skills.
Each time you modify the SQL property of a query, the size of your database
increases. This applies to SQL statements that you use in the RecordSource
property of a form or report, as well as to stored queries on the Queries
tab of the Database window.
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.
NOTE: Visual Basic for Applications is called Access Basic in Microsoft
Access version 2.0. For more information about Access Basic, please refer
to the "Building Applications" manual.
CAUSE
The query is saved each time you modify its SQL property. Because the
Microsoft Jet database engine does not reuse the same space in the database
when the query is saved, the database increases in size.
RESOLUTION
You can use the following techniques to work around the problem:
- Compact your database, which can reduce the size of the database by compressing unused space in the database file.
- If you are modifying SQL pass-through queries, consider using temporary QueryDef objects in code when you need to alter the SQL statement. Because the query is not stored, the database does not increase in size. For more information about creating temporary queries, please see the following article in the Microsoft Knowledge Base:
124391
ACC: Sample Code for Running Temporary SQL Pass-Through Query
NOTE: A disadvantage to this method is that you cannot bind a form or
report to a temporary QueryDef object.
- In Microsoft Access 97, use ODBCDirect to query an ODBC data source. For more information about opening a recordset using ODBCDirect, search the
Help Index for OpenRecordset method or ODBCDirect workspaces.
NOTE: A disadvantage to this method is that you cannot bind a form or
report to a recordset unless you programmatically bind each field and
manage record navigation in code.
REFERENCES
For an example of modifying the SQL property of a pass-through query, see
"Building Applications with Microsoft Access 97," Chapter 19, "Developing
Client/Server Applications," pages 550-551.
For more information about using parameters in pass-through queries, please
see the following article in the Microsoft Knowledge Base:
131534
ACC: How to Simulate Parameters in an SQL Pass-Through Query
Modification Type: | Minor | Last Reviewed: | 10/11/2006 |
---|
Keywords: | kbprb kbProgramming KB165823 |
---|
|