troubleshooting Question

Set Access Database column properties using ADOX

Avatar of Mike_Stevens
Mike_StevensFlag for United States of America asked on
Microsoft Access.NET Programming
2 Comments1 Solution1535 ViewsLast Modified:
I am creating an MSAccess database from within a VB.NET Windows application using the following method:

            Dim cat As New ADOX.Catalog
            Dim tab As New ADOX.Table
            Dim idx As New ADOX.Index
            Dim col As New ADOX.Column

            cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sDB & ";Jet OLEDB:Engine Type=5")
            Application.DoEvents()

            Do Until sF.Exists = True
            Loop

            'Database has been created.  Now create table(s)
            tab.Name = "tblInfo"

            tab.Columns.Append("Order_ID", DataTypeEnum.adVarWChar, 12)
            tab.Columns.Append("Order_Date", DataTypeEnum.adVarWChar, 5)
            tab.Columns.Append("Field1", DataTypeEnum.adVarWChar, 5)
            tab.Columns.Append("Field1", DataTypeEnum.adVarWChar, 5)
            .....
                 
            idx.Name = "tableindexes"
            idx.Columns.Append("Order_ID")
            idx.Columns.Append("Order_Date")
         
            cat.Tables.Append(tab)
            Application.DoEvents()

The problem that i am having is when the database and table is created, all of the columns "Required" property is set to True.  I need to have all columns "Required" property set to "False" so that data is not required.  

How can I do this?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros