Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 23rd, 2006, 01:13 PM
Registered User
Join Date: May 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Dormarth
Default How create a DBF db and set size of a field


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)

        End With
    End With

    cat.Tables.Append tbl

    Set cat = Nothing
end function

Old May 30th, 2006, 04:21 AM
Registered User
Join Date: May 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

Hi. I have exactly the same problem about controlling the size of numeric fields using Microsoft.Jet.OLEDB.4.0 provider. please let me know if you find a solution.

thank you

Home is where your head is
Old May 30th, 2006, 06:06 AM
Registered User
Join Date: May 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Dormarth

Hi! Tanks for write!
But I didn´t have progress yet. I created this same topic in another foruns, but none answered. I make many research in the internet and I found one possible solucion, but didn´t work...
So, if you want this solucion, please, send me one e-mail ([email protected])... I don´t publish here, because the copyright!

And be pacient with my english! I´m just studing...

Tanks! See you...

Similar Threads
Thread Thread Starter Forum Replies Last Post
set up image size goldenstate BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 4 February 15th, 2007 07:37 PM
set image size from attribute bonekrusher XSLT 12 August 10th, 2006 05:49 AM
set size of window on load SoC Javascript How-To 3 September 14th, 2004 03:22 AM
how to set the paper size in javascript sundarisekaran J2EE 1 July 15th, 2004 04:42 PM
DB Size acko SQL Server 2000 2 March 8th, 2004 05:21 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.