Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2006
    Posts
    42

    Unanswered: indexed property

    What is wrong with my function to change index ? I want to change the indexed property of the field delays from the table visits but i do not know am i doing this properly.Could you help ? The field delays has the indexed property set to Indexed Yes(Duplicates OK) and i want to remove it with the function below
    Public Function Cur()

    Dim dbs As DAO.Database
    Set dbs = CurrentDb
    Dim tdf As DAO.TableDef
    Dim fld As DAO.Field
    Dim prp As DAO.Property
    Dim idx As DAO.Index
    Set tdf = dbs.TableDefs("visits")

    Set idx = tdf.CreateIndex("delays")

    idx.Unique = False
    tdf.Indexes.Append idx

    dbs.Close
    Set prp = Nothing
    Set idx = Nothing
    Set fld = Nothing
    Set tdf = Nothing
    Set dbs = Nothing
    End Function

  2. #2
    Join Date
    Apr 2004
    Location
    outside the rim
    Posts
    1,011
    At first glance, it looks like you are CREATING a new index, setting it to NOT UNIQUE and adding it to the end of the table.

    Have you code following the same sequence as your verbal description of what you want to do.

    Open the table
    Grab the field
    Change the index property of the field
    Update the table
    Save the table

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •