Retrieving Field Properties

The procedure in Hands-On 11-7 retrieves the field properties of the field named Id located in tblFilters in the current database.

© Hands-On 11-7: Listing Field Properties

1. In the Visual Basic Editor window, choose Insert | Module.

2. In the module's Code window, type the List_FieldProperties procedure shown below.

3. Choose Run | Run Sub/UserForm to execute the procedure.

Sub List_FieldProperties() Dim cat As ADOX.Catalog Dim col As ADOX.Column Dim pr As ADOX.Property

Set cat = New ADOX.Catalog

Set cat.ActiveConnection = CurrentProject.Connection Set col = New ADOX.Column

Set col = cat.Tables("tblFilters").Columns("Id")

Debug.Print "Properties of the Id field " & _

"(" & col.Properties.Count & ")" ' retrieve Field properties For Each pr In col.Properties

Debug.Print pr.Name & "="; pr.Value Next

Set cat = Nothing End Sub

Figure 11-5: Running the procedure in Hands-On 11-7 generates a list of field properties and their values in the Immediate window.

Part II

0 0

Post a comment