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

rgds
san

Hi,

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

hey

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

Hi,

Comment it .. or
use SET

Set ACat = New ADOX.Catalog

Regards
Veena

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.

Hi,

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
Next

Regards
Veena

Thanks a lot yaar

Its working fine

gr8 job

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.