I believe so, but you will need to iterate through the properties collection of the table to find the correct property name to set the primary key. Here is a function with some code commented out that you could modify. You will need an adox library reference.
Function catalogInfo()
'-- set reference to ADOX library
'- Microsoft ADO Ext. 2.6 for DDL and Security
'-- Microsoft ActiveX data objects 2.6 library also needed for ADO
Dim cg As New ADOX.Catalog
Dim tb As New ADOX.Table
Dim cn As adodb.Connection
Dim cl As ADOX.Column
Set cg.ActiveConnection = CurrentProject.Connection
''tb.Name = "Test"
''tb.Columns.Append "col1", adInteger
''tb.Columns.Append "col2", adVarWChar, 50
''Debug.Print "table = "; cg.Tables("Test".Name
''cg.Tables.Append tb
''Exit Function
'-rename a column
''Set tb = cg("test"
''Set cl = tb("col2aa"
''Debug.Print cl
''Set zero length property on col2aa.
''cl.Properties("Jet OLEDB:Allow Zero Length" = True
''cl.Name = "col2aa"
Set tb = cg.Tables("Categorys"
Debug.Print "table name = "; tb.Name
'- Iterate the property collection.
Dim pp As Property
For Each cl In tb.Columns
Debug.Print "name = "; cl.Name
Debug.Print "type = "; cl.Type
For Each pp In cl.Properties
Debug.Print "property name = "; pp.Name
Debug.Print "property value = "; pp.Value
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.