CreateDatabase method not working

G

Guest

I am using Access 2002, and I need to create a new(empty)
mdb from within the vba code of a form on another mdb.

A previous posting suggested using the CreateDatabase
method of the Application object. So I looked up the
Application object in the help, but no CreateDatabase
method was listed for the Application Object. I did find
the DAO CreateDatabase Example in help, but when I tried
it, neither the 'Database' object (in the dim statement)
nor the CreateDatabase command was not recognized by the
compiler.

dim newDB as Database
set newDB = CreateDatabase("NewDB.mdb",dblanggeneral)

Any help on this would be greatly appreciated.
 
B

Brendan Reynolds

You need to add a reference (in the VBA editor, choose References from the
Tools menu) to the Microsoft DAO 3.6 Object Library.
 
B

Brendan Reynolds

I don't know. If there is, I suspect it might require using the ADOX object
library, which personally I wouldn't touch with the proverbial ten-foot
barge pole. I would look into it for you, at least briefly, if I had a
working ADO help system, but ADO help is broken on my system, and I've given
up fixing it because every MDAC update just breaks it again.

There really is no reason to avoid using DAO in an MDB these days. The old
argument about ADO being the data access method of the future is long dead.
ADO is now every bit as 'obsolete' as DAO. There's nothing wrong with using
ADO if/when it provides an easier method of doing something than DAO, but
there really is no reason to prefer ADO to DAO when there is a perfectly
good and simple DAO method to get the job done.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top