Nullability Attribute on New Column in Existing Table (using ADOX)

G

Guest

Hello.

I know some (or many) of you will disapprove of using ADOX to define tables,
columns, etc. but it's what I must do.

I have a table that already exists, and I want to add some columns to it.
On a particular date column, I need to set its "Nullable" attribute to False.
I know the syntax for doing it, and if I were creating the table for the
first time, this code works. But when the table already exists, and I run
this code, I receive the "Multiple-step OLE DB operation generated errors."
error. Anyway, here is the code snippet that generates the error:

Dim adox_Table as ADOX.Table
..
..
..
With adox_Table
.Append MyDateField, adDate
.Item(MyDateField).Properties("Nullable") = True
End With

Anyone have any insights as to why this won't work on an already-existing
table? I have also tried using an ADOX.Column object, setting its
nullability property, and it generates the same error.

Thanks very much!!
John
 
A

Allen Browne

Hi John

What version of ADOX are you using?
I have a faded memory of hitting this problem, and solving it by upgrading.
I'm currently using 2.8, but 2.7 seems to be the latest version available.
 
A

Allen Browne

Hi John

Just traced down the code that I was trying to use with ADOX 2.8, and it
still gives this error:
Run-time error '-2147217887 (80040e21)':
Multi-step OLE DB operation generated errors. Check each OLE DB
status value, if available. No work was done.

That must have been about the time that I gave up trying to use ADOX at all.
As you hinted in your original post, most of us have found this library to
be so incomplete and buggy as to be unworkable.

It's dead easy to set the Required property with DAO:
CurrentDb().TableDefs("MyTable").Fields("MyField").Required = True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top