FIX: Name Not Found in This Collection When Deleting MemberLast reviewed: October 30, 1997Article ID: Q107362 |
3.00
WINDOWS
kbprg kbbuglist
The information in this article applies to: - Professional Edition of Microsoft Visual Basic for Windows, version 3.0
SYMPTOMSThe Delete method incorrectly reports the following message for the existing member under certain conditions:
Name not found in this collection. Error 3265.This occurs when you use the OpenDatabase function to open a database, and then immediately, as the first change to the database's structure, execute a Delete method on a member of a TableDefs or Indexes collection. The member can be a TableDef or Index.
CAUSEThe problem occurs when a Delete method is the first data definition language (DDL) operation after you open the database.
WORKAROUNDTo work around the bug, use the Refresh method on the Indexes collection before using the Delete method. An example is shown in "Workaround Example" under the More Information section below. NOTE: A program will correctly give the above error message when the name truly is not found in the collection. As soon as a Delete method succeeds on a specified TableDef or Index member of a collection, that name will no longer be found in the collection.
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem has been corrected in Visual Basic version 4.0.
MORE INFORMATION
Steps to Reproduce Problem
Workaround ExampleTo work around this bug, use the Refresh method before using the Delete method:
db.TableDefs("Titles").Indexes.RefreshAs an alternative workaround, replace the Delete line with this command:
' Enter the following two lines as one, single line: db.TableDefs("Titles").Indexes.Delete db.TableDefs("Titles").Indexes("PubID")This command expands "PubID" into its complete reference:
db.TableDefs("Titles").Indexes("PubID")This refreshes the Indexes collection before PubID is deleted in the same statement. NOTE: If you run the program twice using the workaround, the program correctly gives the error, "Name not found in this collection." The error is correct this time because the PubID index member was successfully deleted and no longer exists.
|
Additional reference words: buglist3.00 3.00 fixlist4.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |