Results 1 to 2 of 2

Thread: delete columns

  1. #1
    Join Date
    Sep 2005

    Unanswered: delete columns

    part 1:
    tbl.Fields.Delete tbl.Fields(0).Name
    tbl.Fields.Delete tbl.Fields(1).Name
    tbl.Fields.Delete tbl.Fields(2).Name

    part 2:
    tbl.Fields.Delete "field0"
    tbl.Fields.Delete "field1"
    tbl.Fields.Delete "field2"

    From the above codes:
    the part 1 does NOT work.
    the part 2 work.

    If I run the part 1, then it give out the following message:
    "Cannot delete a field that is part of an index or is needed by the system."

    Can we have a way to run as similar as the part 1?

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    yes you can
    query the indexes object, delete any indexes (including any foreign keys referencing that column) containing the columns you want to delete, then delete the column(s) as required.
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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