ADO OLEDB Jet Property ADOX "Required"

  • Thread starter Thread starter George Hester
  • Start date Start date
G

George Hester

I have made a table with Properties using the Catalog Object from ADOX. I have an OLE Object field and by default that field has the "Required" Property set to "Yes." I'd prefer it set to "No." So I tried this:

tblLoadOLE.Columns("OLEFile").Properties("Required") = "No"

But that doesn't work. The error is:

ADODB.Properties error '800a0cc1'

Item cannot be found in the collection corresponding to the requested name or ordinal.

Any suggestions how to set the "Required" Property to "No?" Thanks.
 
George Hester said:
I have made a table with Properties using the Catalog Object from
ADOX. I have an OLE Object field and by default that field has the
"Required" Property set to "Yes." I'd prefer it set to "No." So I
tried this:

tblLoadOLE.Columns("OLEFile").Properties("Required") = "No"

But that doesn't work. The error is:

ADODB.Properties error '800a0cc1'

Item cannot be found in the collection corresponding to the requested
name or ordinal.

Any suggestions how to set the "Required" Property to "No?" Thanks.

I've never worked with ADOX, but a quick look at the help file suggests
that you want this:

With tblLoadOLE.Columns("OLEFile")
.Attributes = .Attributes Or adColNullable
End With

Let me know if that works.
 
Hi Dirk:

Well I probably should have just tried the obvious. I thought since this was a field of an OLE Object that the Property of the field would be different. I did find that there was some sort of bug on this located here:

http://support.microsoft.com/default.aspx?scid=kb;en-us;185823

but that really wasn't exactly my issue. At least I don't think so. It turns out for other fields a text one for example I am able to Require it to be non-nullable by doing this:

tblLoadOLE.Columns("OLEPath").Properties("Nullable") = False

As you can tell OLEPath the value that should be in this field is text (255) and the above makes that field (OLEPath) not accept nothing. So I should have just tried this:

tblLoadOLE.Columns("OLEFile").Properties("Nullable") = True and OLEFile is a OLE Object field.

Well there you go. The OLEFile field now says, Not Required = "Yes" Hmmm...seems obvious don't it? Sorry for the inconvience but thank you for responding.
 
Back
Top