Link to home
Start Free TrialLog in
Avatar of Mike_Stevens
Mike_StevensFlag for United States of America

asked on

Set Access Database column properties using ADOX

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?
ASKER CERTIFIED SOLUTION
Avatar of Dirk Haest
Dirk Haest
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mike_Stevens

ASKER

Thanks...that is what I needed