Create Dynamic Table in Access 2000 using ADO 
Author Message
 Create Dynamic Table in Access 2000 using ADO

Can anyone give me the code to Make a Dynamic Table in Access 2000 using ADO
coding such that the Table has one Autonumber Feild, one Integer, One Long
integer and one Text feild.


Fri, 17 Jun 2005 18:45:01 GMT  
 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



Fri, 17 Jun 2005 19:19:37 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Link FoxPro Table in Access 2000 using ADO

2. Create Index using SQL in Access 2000 Table

3. Add fields to an Access 2000 Table on the fly using ADO 2.1

4. Creating Tables in Access 2000 using SQL Text files

5. Create Index using SQL in Access 2000 Table

6. Modify Access 2000 table structure using ADO in VB6

7. Create Index using SQL in Access 2000 Table

8. transferspreadsheet with dynamic query (ADO, Access 2000)

9. VBA - Access 2000 Create a table and access the fields

10. Creating new fields in Access tables using ADO 2

11. accessing Access 2000 Report using VB6 ADO

12. Can't access db in Access 2000 using ADO

 

 
Powered by phpBB® Forum Software