Creating autonumber field programmatically

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
 
D

Douglas J. Steele

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.
 
A

Amy Blankenship

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.
 
Top