Show how to alter field properties using ADOX in VBA
Function ModifyFieldPropAdox() 'Purpose: Show how to alter field properties, using ADOX. 'Note: You cannot alter the DefinedSize of the field like this. Dim cat As New ADOX.Catalog Dim col As ADOX.Column Dim prp As ADOX.Property cat.ActiveConnection = CurrentProject.Connection Set col = cat.Tables("MyTable").Columns("MyField") 'col.ParentCatalog = cat Set prp = col.Properties("Nullable") 'Read the property Debug.Print prp.Name, prp.Value, (prp.Type = adBoolean) 'Change the property prp.Value = Not prp.Value 'Clean up Set prp = Nothing Set col = Nothing Set cat = Nothing End Function
No comments:
Post a Comment