Susan Harkins
harkins at iglou.com
Tue Sep 2 14:57:02 CDT 2003
More than one way to do it -- SQL: ALTER TABLE tbl ADD COLUMN fld AUTOINCREMENT CONSTRAINT pk PRIMARY KEY ADOX: Function AddAutoNumberField(fldname As String, seedvalue As Long, _ incvalue As Long, tblname As String) Dim cat As New ADOX.Catalog Dim col As New ADOX.Column cat.ActiveConnection = CurrentProject.Connection With col .Name = fldname .Type = adInteger Set .ParentCatalog = cat .Properties("AutoIncrement") = True .Properties("Seed") = CLng(seedvalue) .Properties("Increment") = CLng(incvalue) End With cat.Tables(tblname).Columns.Append col Set cat = Nothing Set col = Nothing End Function ----- Original Message ----- From: "Randall Anthony" <ranthony at wrsystems.com> To: <accessd at databaseadvisors.com> Sent: Tuesday, September 02, 2003 3:23 PM Subject: [AccessD] Alter Table > Hi all, > I know this has got to be an easy one, but help in XP and 2K is driving me > nuts!! I just want to alter an A2K table with code and create a primary key > in it. Any suggestions? Thanks a bunch. > > Randy @ ext. 473 > > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > >