Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2002
    Posts
    192

    Unanswered: Autonumber Field

    I am trying to create an AutoNumber field in code.
    Is there a way to do this?
    Currently i can create a long integer field but not an autonumber with the following line of code.

    MyTdf.Fields.Append MyTdf.CreateField(l_TableName & "ID", dbLong)

    i've tried substituting dbAutoIncrField in place of dbLong but it only adds it as DataType = Number and FieldSize = Decimal instead of Datatype Autonumber.

  2. #2
    Join Date
    Mar 2002
    Posts
    192
    NM figured it out. In case anyone was wondering, you need to assign it as a property to that field you wish to autonumber.

    tdfNewTable.Fields(l_TableName & "ID").Attributes = tdfNewTable.Fields(l_TableName & "ID").Attributes Or dbAutoIncrField ' Add the Autonumber field.

Posting Permissions

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