You need to add a Long Integer, then change its attribute to
dbAutoIncrField:
Dim fld1 As DAO.Field
Set fld1 = tdf.CreateField("ID", dbLong)
fld1.Attributes = fld1.Attributes + dbAutoIncrField
tdf.Fields.Append fld1
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
"Bo Hansson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> When creating Access tables from my Word VBA application I try the
> following:
>
> tdf.Fields.Append .CreateField("ID", dbAutoIncrField)
>
> to get an auto incrementing field. The table is nicely created, but the
data
> type of
> the auto field becomes an Integer. What's wrong ?
>
> /BosseH
>
>