Results 1 to 3 of 3

Thread: AUTONUMBER

  1. #1

    Thread Starter
    Hyperactive Member PITBULLCJR's Avatar
    Join Date
    Nov 1999
    Location
    New York
    Posts
    408

    Talking

    OK got a question you can create fields like so:
    Set tdftable = dbsData.CreateTableDef("Vocab")
    With tdftable
    .Fields.Append .CreateField("Word", dbText)
    .Fields.Append .CreateField("Def", dbText)
    End With
    dbsData.TableDefs.Append tdftable

    Now in the database there is a way to create it with that autonumber function. How can you do that in code.
    I thought it would be something like this
    Set tdftable = dbsData.CreateTableDef("Vocab")
    With tdftable
    .Fields.Append .CreateField("ID", dbautonumber)
    .Fields.Append .CreateField("Word", dbText)
    .Fields.Append .CreateField("Def", dbText)
    End With
    dbsData.TableDefs.Append tdftable
    but thats no good. thanks
    Sincerely,
    Chris


    Email: [email protected]
    AIM: KnightsOfTheMoon
    WebPage: http://kom.wicre.com
    ----------------
    VB6 Professional
    Abit ST6-RAID
    1000 MHZ
    512 MB PC133 Ram
    Nvidia GeForce 2 Ultra 64 MB
    Maxtor 81.9 Gig
    Win 98 SE

  2. #2
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    I don't know if there is way to do this with the CreateField method, but there is a way to do it with an embedded SQL statement (using the Database object's Execute method). You could do this:

    dbsData.Execute _
    "CREATE TABLE Vocab (ID AUTOINCREMENT, Word TEXT, Def TEXT)"

  3. #3

    Thread Starter
    Hyperactive Member PITBULLCJR's Avatar
    Join Date
    Nov 1999
    Location
    New York
    Posts
    408

    Cool

    Thanks!! It Works Great!!!
    Sincerely,
    Chris


    Email: [email protected]
    AIM: KnightsOfTheMoon
    WebPage: http://kom.wicre.com
    ----------------
    VB6 Professional
    Abit ST6-RAID
    1000 MHZ
    512 MB PC133 Ram
    Nvidia GeForce 2 Ultra 64 MB
    Maxtor 81.9 Gig
    Win 98 SE

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