DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Indexed.Yes.(Duplicates OK)

  1. #1
    Join Date
    Mar 2006

    Indexed.Yes.(Duplicates OK)

    Indexed.Yes (Duplicates OK).

    In my code for remote control i wanted to remove the property Indexed of a field, but i receive the date type conversion error.How can i change these properties by code ?
    At the end of the list of the properties of the field,just below Required, it is written Indexed.Yes (Duplicates OK). i want to turn it to No and i write False, but it says property is unkown. What is the exact property and the command to turn it to No ?

    Below is a part of my code
    Set tdf = dbs.TableDefs("customers")
    Set fld = tdf.Fields("afid")
    fld.Properties("Indexed") = False
    Set fld = Nothing
    Set tdf = Nothing
    Set dbs = Nothing
    Set wsp = Nothing


    The Access interface is not the same as the DAO object model. I know I will have to loop through the Indexes collection of the TableDef, and loop through the Fields collection of each index to see if the field is among them.
    And if so, to delete the index. Of course, it is much easier to delete the index in the Access interface,but for the time being I cannot do that, I have no access to the Access interface and i will have to send the code and beside I have about 7 users in different towns that makes the matter difficult to me.
    Is it possible to help me writing out the code for that? I will be much indebted.

  2. #2
    Join Date
    Nov 2003
    Portland, OR
    Dim db As Database
    Dim td As TableDef
    Dim fld As Field
    Dim ix As Index
    Const FieldName As String = "FieldName"
    Set db = OpenDatabase("d:\path\file.mdb")
    Set td = db.TableDefs("TableName")
    For Each ix In td.Indexes
        For Each fld In ix.Fields
            If fld.Name = FieldName Then
                td.Indexes.Delete ix.Name
                Exit For
            End If
    Phil Weber

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center