CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2001
    Posts
    57

    Create Access 97 database using ado

    Can anyone tell me how I could create a access 97 database using ado.

    Thanks

    Peter


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Create Access 97 database using ado

    Make sure you have a reference set to the ADOX object library then use the following code.

    Dim objCatalog as ADOX.Catalog

    Set objCatalog = New ADOX.Catalog
    objCatalog.Create "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=c:\mynewdb.mdb"




    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    Jan 2001
    Posts
    57

    Re: Create Access 97 database using ado

    I have tried this but can only access the database through access 2000.

    Thanks



  4. #4
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Create Access 97 database using ado

    change provider from
    Provider=Microsoft.Jet.OLEDB.4.0;"
    to
    Provider=Microsoft.Jet.OLEDB.3.51;"

    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  5. #5
    Join Date
    Mar 2001
    Posts
    6

    Re: Create Access 97 database using ado

    Sub CreateDatabaseX()

    Dim wrkDefault As Workspace
    Dim dbsNew As Database
    Dim prpLoop As Property

    ' Get default Workspace.
    Set wrkDefault = DBEngine.Workspaces(0)


    ' Make sure there isn't already a file with the name of
    ' the new database.
    If Dir("c:\tstproj\proj2\NewDB.mdb") <> "" Then Kill "c:\tstproj\proj2\NewDB.mdb"

    ' Create a new encrypted database with the specified
    ' collating order.
    Set dbsNew = wrkDefault.CreateDatabase("c:\tstproj\proj2\NewDB.mdb", _
    dbLangGeneral, dbEncrypt)

    ' With dbsNew
    ' Debug.Print "Properties of " & .Name
    ' ' Enumerate the Properties collection of the new
    ' ' Database object.
    ' For Each prpLoop In .Properties
    ' If prpLoop <> "" Then Debug.Print " " & _
    ' prpLoop.Name & " = " & prpLoop
    ' Next prpLoop
    ' End With


    dbsNew.Close

    End Sub
    i guess this shud help


Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured