B
BmlKidd
I scanned a table to create new tables via:
Private Sub createtables()
Dim NewTableName As TableDef
Dim NewTableProp
Dim PartPrefixDB
Dim i
Dim KeepMe
Set PartPrefixDB = CurrentDb.OpenRecordset("Parts Prefixes")
With PartPrefixDB
.OpenRecordset.MoveFirst
For i = 1 To .RecordCount
'Create New Table
Set NewTableName =
CurrentDb.CreateTableDef(PartPrefixDB.Fields(0).Value)
With NewTableName
KeepMe = NewTableName.Name
'Insert required fields
.Fields.Append .CreateIndex("seDOCNUM")
.Fields.Append .CreateField("seTITLE", dbText, 40)
.Fields.Append .CreateField("seNOTES", dbMemo)
.Fields.Append .CreateField("seUM", dbText, 3)
.Fields.Append .CreateField("seUSER", dbText, 10)
.Fields.Append .CreateField("DATE", dbDate)
'Append new Table
CurrentDb.TableDefs.Append NewTableName
'Create,populate and append new Description field
Set NewTableProp =
CurrentDb.TableDefs(KeepMe).CreateProperty("Description", dbText,
PartPrefixDB.Fields(1).Value)
CurrentDb.TableDefs(KeepMe).Properties.Append NewTableProp
End With
.MoveNext
Next
End With
End Sub
How can I now edit .Field(0) in each table to be Indexed - "Yes, No
Duplicates" ?
The tables are all still empty so if it easier to do during creation, I can
start over.
Thanks,
----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.
http://www.microsoft.com/office/com...-a4a8-24c0b5411a50&dg=microsoft.public.access
Private Sub createtables()
Dim NewTableName As TableDef
Dim NewTableProp
Dim PartPrefixDB
Dim i
Dim KeepMe
Set PartPrefixDB = CurrentDb.OpenRecordset("Parts Prefixes")
With PartPrefixDB
.OpenRecordset.MoveFirst
For i = 1 To .RecordCount
'Create New Table
Set NewTableName =
CurrentDb.CreateTableDef(PartPrefixDB.Fields(0).Value)
With NewTableName
KeepMe = NewTableName.Name
'Insert required fields
.Fields.Append .CreateIndex("seDOCNUM")
.Fields.Append .CreateField("seTITLE", dbText, 40)
.Fields.Append .CreateField("seNOTES", dbMemo)
.Fields.Append .CreateField("seUM", dbText, 3)
.Fields.Append .CreateField("seUSER", dbText, 10)
.Fields.Append .CreateField("DATE", dbDate)
'Append new Table
CurrentDb.TableDefs.Append NewTableName
'Create,populate and append new Description field
Set NewTableProp =
CurrentDb.TableDefs(KeepMe).CreateProperty("Description", dbText,
PartPrefixDB.Fields(1).Value)
CurrentDb.TableDefs(KeepMe).Properties.Append NewTableProp
End With
.MoveNext
Next
End With
End Sub
How can I now edit .Field(0) in each table to be Indexed - "Yes, No
Duplicates" ?
The tables are all still empty so if it easier to do during creation, I can
start over.
Thanks,
----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.
http://www.microsoft.com/office/com...-a4a8-24c0b5411a50&dg=microsoft.public.access