Consulting

Results 1 to 2 of 2

Thread: Creating access database

  1. #1

    Creating access database

    Hi,

    How to create a access database using vba code?

    Thanks in advance.

    Regards,
    Chandra Shekar B

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    #Const EarlyBound = False 'if using early binding

    '----------------------------------------------------------------
    Sub CreateAccessDatabase(DBPath As String)
    '----------------------------------------------------------------
    #If EarlyBound Then
    Dim oADOCat As ADOX.Catalog

    Set oADOCat = New ADOX.Catalog
    #Else
    Dim oADOCat As Object

    Set oADOCat = CreateObject("ADOX.Catalog")

    #End If

    oADOCat.Create "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=" & DBPath

    Set oADOCat = Nothing
    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •