I am using the code snippet (part of program is below) and would like to make the created fileld "ID" a Primary Key and an AutoNumber field. I cannot find a way to do this in VB6. I currently have a pause in my program and go in and manually make the changes to the "ID" field after this part of the program has completed the I click OK and run the rest of the program to populate the table.
Any help would be appreciated.
Thanks
Set dbsNew = OpenDatabase(App.Path & "\New-db1.mdb")
Set tdfNew = dbsNew.CreateTableDef("REFORMAT")
With tdfNew
.Fields.Append .CreateField("ID", dbLong)
.Fields.Append .CreateField("Owner", dbText, 40)
Set dbindex = .CreateIndex("Owner" & "index")
Set indexfield = dbindex.CreateField("Owner")
dbindex.Fields.Append indexfield
.Indexes.Append dbindex
.Fields.Append .CreateField("Add1", dbText, 25)
.Fields.Append .CreateField("Add2", dbText, 25)
<><><><><><><><><><><><><><><> More of same in here <<<<<
dbsNew.TableDefs.Append tdfNew
End With
dbsNew.Close
Any help would be appreciated.
Thanks
Set dbsNew = OpenDatabase(App.Path & "\New-db1.mdb")
Set tdfNew = dbsNew.CreateTableDef("REFORMAT")
With tdfNew
.Fields.Append .CreateField("ID", dbLong)
.Fields.Append .CreateField("Owner", dbText, 40)
Set dbindex = .CreateIndex("Owner" & "index")
Set indexfield = dbindex.CreateField("Owner")
dbindex.Fields.Append indexfield
.Indexes.Append dbindex
.Fields.Append .CreateField("Add1", dbText, 25)
.Fields.Append .CreateField("Add2", dbText, 25)
<><><><><><><><><><><><><><><> More of same in here <<<<<
dbsNew.TableDefs.Append tdfNew
End With
dbsNew.Close