Results 1 to 4 of 4

Thread: Field AutoIncrement Question?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2001
    Location
    Calgary
    Posts
    273

    Field AutoIncrement Question?

    How can I set up attributes for an autonumber field

    I did like this but no work


    with rstNew

    .Fields .CreateField("Field1", dbLong)
    Field1.Attributes = dbAutoIncrfield

    End With

    Thsi field suppose to be indexed
    mannyso

  2. #2
    Frenzied Member mxnmx's Avatar
    Join Date
    Dec 2001
    Location
    I'm back...now!!!
    Posts
    1,396
    VB Code:
    1. set NewTable = DB.OpenRecordset("test")
    2.  
    3. With NewTable
    4. .Fields.Append .CreateField("Field1", dbLong)
    5. .Fields("Field1").Attributes = 17
    6. end with
    Can't Remember Birthdays or Important Dates- Never Miss any Important Date(s)

  3. #3
    Frenzied Member mxnmx's Avatar
    Join Date
    Dec 2001
    Location
    I'm back...now!!!
    Posts
    1,396
    Using Sql:

    VB Code:
    1. Dim sCmd as String
    2.  
    3. sCmd = "ALTER TABLE [" & TABLENAME & "] ADD COLUMN DBCreatorID INT IDENTITY CONSTRAINT IdxDBCreatorID PRIMARY KEY"
    4.  
    5. DBcn.Execute sCmd
    Can't Remember Birthdays or Important Dates- Never Miss any Important Date(s)

  4. #4
    New Member
    Join Date
    Apr 2004
    Location
    Gulfport, MS
    Posts
    7

    Wink Re: Field AutoIncrement Question?

    thanks MXnMX,

    This came in really handy as I was searching for this subject and came across this post - worked perfectly !!

    -AC

Posting Permissions

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



Click Here to Expand Forum to Full Width