please can u tell me wat is that adodb connection.. i am getting error over there....please reply me..

Recommended Answers

All 4 Replies

Thanks for ur reply..but my problem is i want to change the property allowzerolength of one column to true while creating the table in MSaccess that is through code.. so i am using this below 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 = NothingDim 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


i am not getting that adodb.connection.. so what should i have to do for this..

shashim gowda8,
Sorry for late reply. I have always used the 4 line code of Mr. Pierre for creating MS Access database and tables, and I love that code. Its here

Dim tbl As New Table, cat As New ADOX.Catalog

' 1) Create the DataBase
     cat.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Clients.mdb" & ";"
' 2) Create Table name "ClientsInfo"
     tbl.Name = "ClientsInfo"
' 3) Add 3 Fields
     tbl.Columns.Append "Name", adVarWChar, 50 'Text
     tbl.Columns.Append "Age", adInteger 'Number
     tbl.Columns.Append "Address", adLongVarWChar 'Memo
' 4) Save the Table to the DataBase
     cat.Tables.Append tbl

About setting property to AllowZeroLength, I do believe that by default this property to Yes/True so I don't think you will need extra code for that.

Hope this helps

thank u so much for ur reply.. and i will try that....
thanks again........

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.