Creating Databases from Excel

In a sense, creating a database from the platform that Excel provides is very simple. With a reference to Data Access Objects (DAO) established in a VBA module (as described in Chapter 8, “Opening Databases”), you just execute the following statement:

CreateDatabase Name:= "NewDB.mdb", _ Locale:=dbLangGeneral

That's all there is to it. Executing that statement in VBA creates a new Access database named NewDB.mdb in the default directory. It has no tables or queries or any of the other structures that you normally find in an Access database, but it's there and ready to store them for you.

Of course, that's disingenuous. You need to prepare the ground first. You would want to check that there's not already a file ...

Get Managing Data with Microsoft® Excel now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.