Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: ADOX column properties


Message #1 by "Coral Johnson" <coral@j...> on Tue, 20 Nov 2001 11:35:03 +1000
Try setting the lfldTarget.ParentCatalog property to 
lfldSource.ParentCatalog and then do a lfldTarget.Properties.Refresh.

Regards,
-Toby

P.S.

"Set OLEDB:Allow Zero Length"
        should read:
"Jet OLEDB:Allow Zero Length"


>From: "Coral Johnson" <coral@j...>
>Date: Tue, 20 Nov 2001 11:35:03 +1000
>X-Message-Number: 2
>
>I'm trying to create a new field in a table using ADO and Access 2000.  The
>field is based on a field in another table.  All goes well until I try to
>set properties like Nullable or Default.  The property exists in the field I
>am copying from, but the properties collection is empty in the field I am
>copying to.  How do I get around this problem?  I could do it in DAO, but
>ADO is stopping me.
>
>Coral
>
>Dim lfldTarget As ADOX.Column
>Dim lfldSource As ADOX.Column
>
>       Set lfldSource = ltblNewDBTable(strField)
>       Set lfldTarget = New ADOX.Column
>       With lfldTarget
>          .Name = lfldSource.Name
>          .Type = lfldSource.Type
>          .DefinedSize = lfldSource.DefinedSize
>          .Attributes = adColNullable
>          .Properties("Nullable").Value _
>             = lfldSource.Properties("Nullable").Value
>          If .Type = adChar _
>          Or .Type = adLongVarWChar _
>          Or .Type = adVarWChar Then
>             .Properties("Set OLEDB:Allow Zero Length").Value _
>                = lfldSource.Properties("Set OLEDB:Allow Zero Length").Value
>          End If
>          .Properties("Default").Value _
>             = lfldSource.Properties("Default").Value
>       End With
>       ltblDBTable.Columns.Append lfldTarget


  Return to Index