Can anyone tell me how I could create a access 97 database using ado.
Thanks
Peter
Printable View
Can anyone tell me how I could create a access 97 database using ado.
Thanks
Peter
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]
I have tried this but can only access the database through access 2000.
Thanks
change provider from
Provider=Microsoft.Jet.OLEDB.4.0;"
to
Provider=Microsoft.Jet.OLEDB.3.51;"
Iouri Boutchkine
[email protected]
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