Create Access database with ADO or ADOX from pre-made MDB

Create Access database with ADO or ADOX from pre-made MDB

Post by Jimmy » Sun, 08 Aug 2004 11:48:00


Hello, I'd like to create a Jet 4.0 (Access 2000) MDB database from scratch
from a database I've already created in Access 2000 (with relationships!)
This means I need a program that can generate VB6 code. I'd like to make
any changes in Access and just re-generate the code when needed. It's much
easier than changing just the code and I can test things first.

I found a program called DataWiz
( http://www.yqcomputer.com/ ), but it seems to only use
DAO and I'd like to stick with ADO since it to export data to a database. I
heard you can't use ADO, that you need to use ADOX, which would be fine.

Does anyone know of a good program to do this? It would need to duplicate
relationships too. Free or commercial, it doesn't matter.

TIA!
 
 
 

Create Access database with ADO or ADOX from pre-made MDB

Post by Kees » Sun, 08 Aug 2004 21:48:02

Jimmy,
How very right those people at DataWiz are when they state that it's a very
time-consuming thing to write all the code to create a DB in VB.
That's why in the past I came up with another solution.
I make a copy of only the layout of the existing database and save it as a
read-only (and hidden) "template".
Now if the user decides on making a new fresh empty database, I open the
dialogue-box to get a name for the new database and then programmatically
make a copy of the template with the new filename and .... ta-taah: exactly
like the original.
When anything has to change in the layout later on, I test it first, get rid
of all the data that was put in to test, and then "promote" it to be the new
template...

Would that be of any help?
Kees




scratch
much
use
I

 
 
 

Create Access database with ADO or ADOX from pre-made MDB

Post by Jimmy » Mon, 09 Aug 2004 04:42:38

Right, so you're saying to distribute a copy of the MDB with my software,
possibly hidden (or encrypted), and when they want to export data to a new
database my app. would just make a copy of the MDB where ever they specify
and rename it to the filename they specify, then export the data to it?

I've thought about this and am considering it.
 
 
 

Create Access database with ADO or ADOX from pre-made MDB

Post by Kees » Mon, 09 Aug 2004 06:01:06

It is not perhaps the most elegant solution, but it is the easiest solution
by far if the layout of the database is rather complicated.
I have looked at all alternatives in the past, but this one works best and
it is easy to maintain: when there is a new feature or change in the layout
you change the "template" and all future databases that are created are
up-to-date.
There often are a number of solutions to the same problem, and I don't say
this one is ideal, but I haven't come up with a better one yet!
 
 
 

Create Access database with ADO or ADOX from pre-made MDB

Post by Val Mazu » Tue, 10 Aug 2004 03:41:15

Hi,

One more solution is to prepare SQL scripts, which generate tables and other
objects inside he database. When you need to create database, then you could
run the script from your application and it will create all the objects

--
Val Mazur
Microsoft MVP
 
 
 

Create Access database with ADO or ADOX from pre-made MDB

Post by Luqma » Tue, 10 Aug 2004 04:32:56


Use VB FileCopy Command to copy existing database with new name.

For example:

FileCopy "c:\myFolder\oldDB.mdb","E:\myFolder\NewDB.mdb"


Best Regards,

Luqman





other
could


and
say


software,