Home All Groups Group Topic Archive Search About

Adding column description to Access table, HOW?

Author
13 Jul 2006 10:06 AM
Søren M. Olesen
Hi

I'm trying to add a column and it's description to an Access table using the
following code:

objTable.Columns.Append("RefId", adInteger)
objTable.Columns("RefId").Properties("Description").Value = "Reference Id"

however I get the following exception:

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

Looking at the Column using a debugger, I can see that the column doesn't
contain anything in the Properties collection...

But how do I add a Description to this collection ??

TIA

Søren

Author
13 Jul 2006 11:38 AM
Søren M. Olesen
Think I've figured it out....you'll have to create the column with
description this way:

Dim col As ADOX.Column = New ADOX.Column
With col
    .Name = name
    .Type = type
    .DefinedSize = size
    .ParentCatalog = cat
    .Properties("Description").Value = description
End With




Show quote
"Søren M. Olesen" <smole***@hotmail.com> wrote in message
news:OYvkIQmpGHA.4760@TK2MSFTNGP05.phx.gbl...
>
> Hi
>
> I'm trying to add a column and it's description to an Access table using
> the following code:
>
> objTable.Columns.Append("RefId", adInteger)
> objTable.Columns("RefId").Properties("Description").Value = "Reference Id"
>
> however I get the following exception:
>
> "Item cannot be found in the collection corresponding to the requested
> name or ordinal."
>
> Looking at the Column using a debugger, I can see that the column doesn't
> contain anything in the Properties collection...
>
> But how do I add a Description to this collection ??
>
> TIA
>
> Søren
>

AddThis Social Bookmark Button