PRB: TableDefs Not Updated When SQL Statement Creates TableLast reviewed: June 21, 1995Article ID: Q104339 |
The information in this article applies to:
- Professional Edition of Microsoft Visual Basic for Windows, version 3.0
SYMPTOMSIf you create a table with an SQL action statement such as SELECT INTO, the new table is not immediately reflected in the TableDefs collection of the database object or property. This may result in the error "Name not found in this collection" (error 3265).
WORKAROUND
STATUSThis behavior is by design.
MORE INFORMATIONA table created with an SQL statement is correctly reflected in the Tabledefs collection after the database is closed then reopened.
Steps to Reproduce ProblemThe following program demonstrates this problem. It results in the error "Name not found in this collection" on the Tabledefs.Delete statement.
Dim db As Database Set db = OpenDatabase("BIBLIO.MDB") Print "TableDefs.Count before:"; db.TableDefs.Count ' Create new table using SQL action statement: db.Execute "select distinctrow * into NewTable from Authors" ' Remove apostrophe from the following statement to work around problem: ' db.TableDefs.Refresh Print "TableDefs.Count after: "; db.TableDefs.Count ' Now attempt to delete the new table just created: db.TableDefs.Delete "NewTable" db.Close |
Additional reference words: 3.00 docerr
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |