Click to See Complete Forum and Search --> : seeding access autoincrement


podulator
September 10th, 2001, 12:19 PM
hiya,
anyone know how to seed an autoincrement field to start at any given value.
Code so far is

set SolTd = NewDb.CreateTableDef("sol")

With SolTd
.Fields.Append .CreateField("ID", dbLong)
set NewFld = .Fields("ID")
NewFld.Attributes = DB_AUTOINCRFIELD
End With




thanx
mat

Iouri
September 10th, 2001, 12:27 PM
set ref to ADOX
this code will create a new autoincrement field

Set col = New ADOX.Column
Set col.ParentCatalog = cat
With col
.Type = adInteger
.Name = "ID"
.Properties("Autoincrement") = True
End With
tbl.Columns.Append col

after that I think you can deal with this field as with any other one, i.e. enter any value.

Iouri Boutchkine
iouri@hotsheet.com