
Create Dynamic Table in Access 2000 using ADO
Hi,
You can use ADOX to change it.
1. Reference "Microsoft ActiveX Data Object Library" and "Microsoft ADO
Ext. for DDL and Security" in the project.
2. Here's a piece of code snippet you can refer to:
Dim cn As ADODB.Connection
Dim tbl As New ADOX.Table
Dim cat As New ADOX.Catalog
Set cn = New ADODB.Connection
cn.CursorLocation = adUseClient
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\test.mdb"
Set cat.ActiveConnection = cn
With tbl
.Name = "MyNewTable"
With .Columns
.Append "MyAutoNumber", adInteger
.Append "MyLongInteger", adInteger
.Append "MyInteger", adSmallInt
.Append "MyText", adWChar, 50
With !MyAutoNumber
Set .ParentCatalog = cat
.Properties("Autoincrement") = True
.Properties("seed") = CLng(20)
.Properties("increment") = CLng(20)
End With
End With
End With
cat.Tables.Append tbl
Set cat = Nothing
cn.Close
Set cn = Nothing
Set tbl = Nothing
Regards,
Elan Zhou
This posting is provided "AS IS" with no warranties, and confers no rights.
Got .Net? http://www.gotdotnet.com