Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting property NULLABLE of column using VBA

Status
Not open for further replies.

Dorian123

Programmer
Dec 8, 2002
4
DE
Hi,

how do I set the property NULLABLE of a column using ADOX and VBA?
How/Where do I get a list of all possible properties and attributes of a column?

Thx, Dorian
 
Here is a function that I have used for testing that should give you what you are looking for.


Function catalogInfo()
'-- set reference to ADOX library
'- Microsoft ADO Ext. 2.6 for DDL and Security
'-- Microsoft ActiveX data objects 2.6 library also needed for ADO

Dim cg As New ADOX.Catalog
Dim tb As New ADOX.Table
Dim cn As ADODB.Connection
Dim cl As ADOX.Column
Set cg.ActiveConnection = CurrentProject.Connection

''tb.Name = "Test"
''tb.Columns.Append "col1", adInteger
''tb.Columns.Append "col2", adVarWChar, 50
''Debug.Print "table = "; cg.Tables("Test").Name
''cg.Tables.Append tb
''Exit Function
'-rename a column
''Set tb = cg("test")
''Set cl = tb("col2aa")
''Debug.Print cl
''cl.Properties("Jet OLEDB:Allow Zero Length") = True
''cl.Name = "col2aa"

Set cg.ActiveConnection = CurrentProject.Connection
Set tb = cg.Tables("Categorys")
Debug.Print "table name = "; tb.Name
'''Set cg.Procedures("myproc") = "select * from customer"
Dim pp As Property
''Debug.Print "column = "; tb.Columns("Description").Properties("default").Value
''Exit Function
For Each cl In tb.Columns
Debug.Print "name = "; cl.Name
Debug.Print "type = "; cl.Type
For Each pp In cl.Properties
Debug.Print "property name = "; pp.Name
Debug.Print "property value = "; pp.Value

Next
Next

End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top