views:

1323

answers:

6

I've just designed a large database by playing around in MS Access. Now that I'm happy with the design, I need to be able to generate this same database (tables, relationships, etc.) from code.

Rather than hand-writing the SQL CREATE statements (which will be long, tedious, and error-prone process), I was wondering whether there was a shortcut. I seem to recall from my limited exposure to MySql that I was able to export an entire database as an SQL statement that can then be run in order to regenerate that database.

Do you know of a way to do this in MS Access, either through the GUI, or programmatically?

+2  A: 

The quick and dirty, easy, perfectly legitimate way to do this is just copy the .mdb file. Empty out the data if you need to - usually there are static tables that are handy to leave populated, however.

le dorfier
+1 - Hehe - hadn't really considered that. Funny how the simplest solutions are often the ones you overlook. Unfortunately, our product may be released as a standalone executable, so probably not plausible in this case. Although I guess we could somehow embed the binary data in the exe...
Smashery
+1  A: 

For free for 30 days (then $30) you can give DBWScript a go, looks like its what you are asking for, although not in native Access GUI or programmatically

curtisk
+1  A: 

The thing that you're mentioning in MySQL is sql dumping. Very useful feature. If you want to migrate the database to mysql, here's a helpful article.

http://www.kitebird.com/articles/access-migrate.html#TOC_4

mives
A: 

I don't know what tools you have on your development machine, so the may or may not be helpful.

You can easily transfer your Access database to Microsoft SQL Server using the Upsizing Wizard.

The express edition of SQL Server is available for free > here.

You will also want to get the free Management Studio Express.

Using these free graphical based tools you can easily generate the SQL statments to re-create the database. You will have the Create statments you are looking for and they will be placed in a text file.

JonnyBoats
A: 

Compare'Em http://home.gci.net/~mike-noel/CompareEM-LITE/CompareEM.htm The free version creates VBA while the $10 pro version gives you DDL statements.

Tony Toews