Results 1 to 3 of 3

Thread: insert/datatype

  1. #1
    Join Date
    Sep 2005
    Posts
    313

    Unanswered: insert/datatype

    Q1:
    I have a table, there have 3 fields
    Mytable:
    field1, field2, field3

    However, I want to write the code to add "field0" in the index 0.

    Mytable:
    field0,field1,field2, field3

    Dim db As Database
    Dim tb As TableDef
    Set db = CurrentDb
    Set tb = db.TableDefs("tbl")
    tb.Fields.Append tb.CreateField("field0", dbInteger)

    I used the above code, it only append the field0 at the last column,
    it shows:
    field1,field2, field3, field0.

    How can I move/add to the index 0?

    Q2:
    I want to change the datatype in the field1.
    tb.Fields("Field1").Type = dbinteger

    However, it shows the error message, it is said that it is read-only.
    so, we cannot modify it.
    How can I modify the datatype?

    Please let me know about it. Thanks a lot.

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    I seem to recall type being a read-only property.

    Also,the index of fields really shouldn't matter, that makes me question why you would want to force it. What is the practical application for this index?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Sep 2005
    Posts
    313
    I solved it. Thanks.

Posting Permissions

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