DdfDropIndex
Applies to
VAccess
Description
Removes an index from the current PSQL data file, and, if RefreshLocations is True, also from the data dictionary definition for the current table.
*Note: DdfDropIndex can be very dangerous if used incorrectly, since it alters the index structure of the data file itself. Existing programs which use the data file may no longer work after this operation is performed. Use with extreme caution.
Syntax
object. DdfDropIndex keynum
The DdfDropIndex method syntax has these parts:
 
Return Value
DdfDropIndex returns a two-byte integer that holds the status of the VAccess control. If this is zero, the operation completed successfully.
Remarks
DdfDropIndex will drop the specified index from the actual data file itself. In addition, this function will remove the index from the metadata memory image of the VAccess control. If RefreshLocations is True, DdfDropIndex will then update the DDF files themselves to match the current memory image. If DdfTransactionMode is True, these actions will be performed inside a transaction.
As a result of dropping an index other than the last index in the file, all indexes will be renumbered. For example, if the third key of a table with five indexes is dropped, key #3 will be moved to key #2 and key #4 will become key #3. DdfDropIndexMaintain can be used to drop an index without disrupting other keys of the table.
Example
'kill all existing applications that use indexes
For i = 0 To VAEngine.TotalKeys – 1
'TotalKeys will be decremented each pass,
'so always kill key 0
status = VANew.DdfDropIndex(0)
If status > 0 Then
errorMsg = "Error occurred during Drop " _
+ "Index " + CStr(i) + _
" operation. Btrieve status " + _
CStr(status) + ". "
MsgBox errorMsg, vbExclamation
End If
Next i
See Also
IndexList, RefreshLocations , DdfAddIndex, DdfDropIndexMaintain