Click to See Complete Forum and Search --> : Create Access 97 database using ado


PeterP
March 13th, 2001, 09:18 AM
Can anyone tell me how I could create a access 97 database using ado.

Thanks

Peter

Iouri
March 13th, 2001, 10:07 AM
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
iouri@hotsheet.com

PeterP
March 13th, 2001, 10:16 AM
I have tried this but can only access the database through access 2000.

Thanks

Iouri
March 13th, 2001, 10:43 AM
change provider from
Provider=Microsoft.Jet.OLEDB.4.0;"
to
Provider=Microsoft.Jet.OLEDB.3.51;"

Iouri Boutchkine
iouri@hotsheet.com

reshmavs
March 19th, 2001, 05:12 AM
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