Dim tdfCurr As DAO.TableDef
Dim fldID As DAO.Field
Set tdfCurr = CurrentDb().TableDefs("ExistingTable")
Set fldID = tdfCurr.CreateField("NewField", dbLong)
fldID.Attributes = dbAutoIncrField
tdfCurr.Fields.Append fldID
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"Ed Cohen" <(E-Mail Removed)> wrote in message
news:2E57D9A4-A3EF-4CD1-972D-(E-Mail Removed)...
> Question - I am trying to create a field that has the datatype of
> AutoNumber
> in code. The help page that has the datatypes does not list anything that
> corresponds to the AutoNumber datatype. I need this for a table I am
> creating
> in VBA - Access 2000. The New values property is automatically set to
> Increment. Again, how do you do this in VBA? Thanks.
>
> Ed