D
Duck
I am very new to VBA and ADOX and in trying to come up with a simple
procedure to create a small table I get the error message:
"Multiple Step OLE DB operation generated errors. Check each OLE DB
status value, if available. No work was done"
I don't know what I'm doing wrong...Here's my code:
Public Sub CreateTable()
'This procedure will create a table
'Declare variables
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table
Dim col As ADOX.Column
'Define catalog object
Set cat = New ADOX.Catalog
Set cat.ActiveConnection = CurrentProject.Connection
'Define table object
Set tbl = New ADOX.Table
tbl.Name = "tblClient2"
'Define column object
Set col = New ADOX.Column
col.Name = "CustID"
col.Type = adInteger
Set col.ParentCatalog = cat
col.Properties("Autoincrement") = True
col.Properties("Description") = "Client ID number"
tbl.Columns.Append col
Set col = New ADOX.Column
col.Name = "FirstName"
col.Type = adVarWChar
Set col.ParentCatalog = cat
col.Attributes = adColNullable
col.Properties("Description") = "Client First Name"
tbl.Columns.Append col
Set col = New ADOX.Column
col.Name = "LastName"
col.Type = adVarWChar
Set col.ParentCatalog = cat
col.Attributes = adColNullable
col.Properties("Description") = "Client Last Name"
tbl.Columns.Append col
cat.Tables.Append tbl
End Sub
Can anyone shed any light on the error of my ways???
procedure to create a small table I get the error message:
"Multiple Step OLE DB operation generated errors. Check each OLE DB
status value, if available. No work was done"
I don't know what I'm doing wrong...Here's my code:
Public Sub CreateTable()
'This procedure will create a table
'Declare variables
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table
Dim col As ADOX.Column
'Define catalog object
Set cat = New ADOX.Catalog
Set cat.ActiveConnection = CurrentProject.Connection
'Define table object
Set tbl = New ADOX.Table
tbl.Name = "tblClient2"
'Define column object
Set col = New ADOX.Column
col.Name = "CustID"
col.Type = adInteger
Set col.ParentCatalog = cat
col.Properties("Autoincrement") = True
col.Properties("Description") = "Client ID number"
tbl.Columns.Append col
Set col = New ADOX.Column
col.Name = "FirstName"
col.Type = adVarWChar
Set col.ParentCatalog = cat
col.Attributes = adColNullable
col.Properties("Description") = "Client First Name"
tbl.Columns.Append col
Set col = New ADOX.Column
col.Name = "LastName"
col.Type = adVarWChar
Set col.ParentCatalog = cat
col.Attributes = adColNullable
col.Properties("Description") = "Client Last Name"
tbl.Columns.Append col
cat.Tables.Append tbl
End Sub
Can anyone shed any light on the error of my ways???