Create Access database using ADOX
Google
Web www.mahipalreddy.com

What is Microsoft ActiveX Data Objects Extensions for Data Definition Language and Security 2.1 (ADOX) and how to use it to create a MS Access database

The article briefly discusses about ADOX and shows you how to create access database using Create method of the ADOX catalog object..

Microsoft ActiveX Data Objects Extensions for Data Definition Language and Security 2.1 are extensions to the base ADO functionality that allow you to perform data definition language (DDL) functions such as creating databases, and creating, modifying, or deleting tables, views (queries), stored procedures, indexes, and relationships.
ADOX Also includes security objects to maintain security on user and group accounts, and to grant and revoke permissions on objects.

 

 

To create a database by using ADOX, we use the Create method of the Catalog object

The first thing you need to do before getting started is to add a reference to Microsoft ADO Ext. 2.x for DDL and Security Obect Lirary from VB references dialog. (goto Project-->References-->Microsoft SQLDMO Object Library)

Sub CreateAccessDatabase()
    Dim catNewDB As ADOX.Catalog
    
    Set catNewDB = New ADOX.Catalog
    strDBPath = "C:\test.mdb"
    
    catNewDB.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath
    
    Set catNewDB = Nothing
    MsgBox "done"
End Sub

Top

www.mahipalreddy.com
Terms and Conditions of Use
Copyright 2004 - 2006 Mahipal Padigela. All rights reserved.