Quilty Kim
Quilty Kim

Reputation: 463

how to generating a new mdb file from Visual Studio 2015 Community(Visual Basic)

I've been looking all over the internet to find how to create an mdb or accdb Access file using Visual Studio 2015 Community to no avail. The closest I've gotten was to being advised to use references, the VSTO(not available for Access) plugin, and the ADO library. Unfortunately, all my leads eventually led either to libraries that don't have the "CreateDatabase" or "CreateAccessDatabase" functions in the API or to pages explaining how to connect to or open mdb/accdb/sql files. While I'd prefer help in Visual Basic, I'd appreciate any help with the languages supported by Visual Studio as I imagine it comes down to finding the right library.

Upvotes: 1

Views: 1567

Answers (2)

muffi
muffi

Reputation: 364

    Dim AccessDatabaseEngine As New Microsoft.Office.Interop.Access.Dao.DBEngine
    Dim AccessDatabase As Microsoft.Office.Interop.Access.Dao.Database
    AccessDatabase = AccessDatabaseEngine.CreateDatabase("YOUR_FILENAME.accdb", Microsoft.Office.Interop.Access.Dao.LanguageConstants.dbLangGeneral)
    AccessDatabase.Close()

Upvotes: 2

Gustav
Gustav

Reputation: 56016

Though not in VB.NET, this should get you going:

Create Access Database at runtime in C#

Do note however, that JET is used for mdb files only, and JET Oledb 4.0 exists for 32-bit only.

Upvotes: 0

Related Questions