Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating new table through ADOX

Status
Not open for further replies.

vishalmarya

Programmer
Aug 19, 2001
28
I am trying to create a new table in mdb file.

Here is the code

''**********************

Dim cn As New ADODB.Connection

Dim cat As New ADOX.Catalog

Dim otable As New ADOX.Table, ocol As New ADOX.Column

cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\test.mdb"

cat.ActiveConnection = cn


otable.Name = "newtable"

cat.Tables.Append otable

ocol.Name = "fld1"

ocol.Type = adVarWChar

ocol.DefinedSize = 100

otable.Columns.Append ocol


ocol.Properties(2) = "Test description" '' description prop
ocol.Properties(13) = True '' Allow zero length prop

ocol.Properties(3) = True '' Required prop

''**********************

following error is generated in Last statement :

"Multiple-step OLE DB operation generated errors. Check each OLE DB Status value, if available. No work was done.
 
You need to append the columns to the table before appending the table to the catalog. The error being generated is that you cannot append a table that contains no fields.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top