can any one help me in the following problem

i have created a database and its table at runtime(i.e. while running the exe). the problem is that i need to change properties of table such as 'required' and 'allow zero length' of a table. how to change these properties and other properties at the run time



Try this code:

Dim AConn As New ADOdb.Connection
Dim ACat As New ADOX.Catalog
Dim ATbl As ADOX.Table
Dim ACol As ADOX.Column
AConn.Open("Provider='Microsoft.Jet.OLEDB.4.0';" _
    & "Data Source= C:\MyDB.mdb;")
ACat = New ADOX.Catalog 
ACat.ActiveConnection = AConn
ATbl = ACat.Tables("MyTable")
ACol = ATbl.Columns.Item("MyColName")
ACol.Properties("Jet OLEDB:Allow Zero Length").Value = True
ACat = Nothing


thanx for the reply.

am getting error as invalid use of property and the error is in
ACat = New ADOX.Catalog

i have set all the properties of adox and catalog control.

can u tell me how to rectify this error

thanx a lot

its working fine

u gave the code for changing the particular column of a table and is there any way to change the properties of the entire table i.e. allow zero length should be set false to all the columns in a table.


Just Loop through all the Available columns and set the property..

For Each ACol In ATbl.Columns
    ACol.Properties("Jet OLEDB:Allow Zero Length").Value = False


u said it for allow zero length and thats working fine. how to change the required property of database table.

This question has already been answered. Start a new discussion instead.