Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 327
  • Last Modified:

Setting a Column's Required Property to False using VBA

I have the following code to append new columns to a table.  The Required property is defaulting to Yes which is causing problems when I run append queries.  How can I modify this property in code?

Dim strSQL As String
Dim cat As ADOX.catalog
Dim cnn As New ADODB.Connection
Dim tbl As ADOX.Table
Dim col As ADOX.Column

Set cat = New ADOX.catalog
Set cnn = CurrentProject.Connection
Set cat.ActiveConnection = cnn

Set tbl = New ADOX.Table

DoCmd.OpenQuery "qryCreateTblChartAll"

Set tbl = cat.tables("tblChartAll")

Set col = New ADOX.Column
col.Name = "Pd_Clm_Num"
col.Type = adVarWChar
tbl.columns.Append col

Set col = New ADOX.Column
col.Name = "Pd_Clm_Amt"
col.Type = adCurrency
tbl.columns.Append col

Set col = New ADOX.Column
col.Name = "Dnd_Clm_Num"
col.Type = adVarWChar
tbl.columns.Append col

Set col = New ADOX.Column
col.Name = "Dnd_Clm_Amt"
col.Type = adCurrency
tbl.columns.Append col
0
jrimmele
Asked:
jrimmele
1 Solution
 
NatchiketCommented:
col.Attributes=adColNullable

note the literal value for adColNullable = 2
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now