Hello.
I´m a
VB programing and I´m from Brazil.
I need some help with DBF database. I already created a DBF code in
VB, but I don´t know how to set size of a field(columns).
For example: When I created a DBF, it came with fields with width 20 and type adNumeric, but I want it with width the size equal 5 and type adNumeric.
How can I do it in
VB?
below it´s my code to generate a DBF
Function fCriaDBF(sPATH As String, sNome As String, vCampos As Variant) As Boolean
Dim cat As New ADOX.Catalog
Dim tbl As New ADOX.Table
Dim i As Integer
Set cat = New ADOX.Catalog
cat.ActiveConnection = "Provider=Microsoft.JET.OLEDB.4.0;Data Source=c:\tmp;Extended Properties=Dbase 5.0;"
Set tbl = New ADOX.Table
With tbl
.Name = sNome
Set .ParentCatalog = cat
With .Columns
For i = 0 To UBound(vCampos)
.Append vCampos(i), adNumeric, CLng(5)
.Item(vCampos(i)).NumericScale = 0
.Item(vCampos(i)).DefinedSize = CByte(5)
.Item(vCampos(i)).Precision = CLng(5)
Next
End With
End With
cat.Tables.Append tbl
Set cat = Nothing
end function