Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create AutoNumber column in Access Database

Status
Not open for further replies.

Haug

MIS
May 12, 2003
6
0
0
DK
I need to create a new column in a table in a MS Access database. I'm usnig the ADOX object to open the file and have no problems creating a new integer-type column but I can't figure out how to make it AutoNumber.
/Haug
 

Set Col = New ADOX.Column
With Col
Set .ParentCatalog = cat
.Name = "AutoNr"
.Type = adInteger
.Properties("AutoIncrement") = True
tbl.Columns.Append Col
End With
 
Thanks a lot for helping out this fast.

I needed to set the .parentcatalog to be allowed to set the "AutoIncrement" = True

/Haug
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top