DOCERR: Revised Index Property (Data Access)

Last reviewed: June 21, 1995
Article ID: Q108235
The information in this article applies to:
  • Microsoft Visual Basic programming system for Windows, version 3.0

SUMMARY

Page 279 of the "Language Reference" discusses the Index Property (Data Access). It has some incorrect and misleading information. This article is a revised and corrected version of the entire Index Property (Data Access) section. Please replace page 279 with this article.

MORE INFORMATION

Index Property (Data Access)

Applies To

   Table object

Description
   With data access, the Index property determines which existing index
   is the current index used to sort records in a Table and in recordsets
   created from that Table. The default is blank. The Index property is
   not available at design time and is available read/write at run time.

Syntax
   table.Index [ = indexname ]

Remarks
   The order of the data in a table is determined by the order in which
   the data is added to the table. To alter the order of records
   fetched from the table when using a Table object, set the Index
   property to the name of an index in the Indexes collection of the
   Table's TableDef object. For example, to set the index to be used on
   a Seek against the Titles table:

   Dim Tb as Table, Db as Database
   Set Db = OpenDatabase("Biblio.MDB")
   Set Tb = Db.OpenTable("Titles")
   Tb.Index = "PubID"
   Tb.Seek "=", 3

   The specified index must already be defined. If you set the Index
   property to an index that doesn't exist, or if the index isn't set
   when you use the Seek method, an error occurs.

   In the Professional Edition, you can create a new Index in a Table
   by creating a new Index object, setting its properties, and then
   appending it to the Indexes collection of the Table's TableDef.

   The records in a Table can be ordered only according to the indexes
   defined for it. To sort the Table records in some other order,
   create a new Index for the table and append it to the Table's Index
   Collection, or create a Dynaset or Snapshot that has a different sort
   order. To specify the sort order for Dynasets and Snapshots, use the
   Sort property after the Dynaset or Snapshot has been created. You can
   also set the order of a Dynaset or Snapshot by including an Order By
   clause in a SQL statement used to define the Dynaset or Snapshot.

   The Index property of a control array element is not the same as the
   Index property of a data access object.

Data Type
   String


Additional reference words: 3.00 docerr
KBCategory: kbprg
KBSubCategory: APrgDataOther


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 21, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.