Creating autonumber field programmatically

  • Thread starter Thread starter Amy Blankenship
  • Start date Start date
A

Amy Blankenship

When you're creating a table definition, what is the constant to make a
field an autonumber vs an integer?

TIA;

Amy
 
How are you creating the table?

If you're using DAO, you need to set the field's Attribute to include
dbAutoIncrField

Set tdf = dbs.CreateTableDef("Contacts")
Set fld1 = tdf.CreateField("ContactID", dbLong)
fld1.Attributes = fld1.Attributes + dbAutoIncrField

If you're using DDL, the type is COUNTER.
 
Thanks a bunch!

Douglas J. Steele said:
How are you creating the table?

If you're using DAO, you need to set the field's Attribute to include
dbAutoIncrField

Set tdf = dbs.CreateTableDef("Contacts")
Set fld1 = tdf.CreateField("ContactID", dbLong)
fld1.Attributes = fld1.Attributes + dbAutoIncrField

If you're using DDL, the type is COUNTER.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top