Create New database

D

DarS

I am trying to create a new Access Database that will contain a table from
the current database. I would like this to happen from a macro or an event
procedure. Any help/suggestions would be appreciated.
 
J

John Nurick

In VBA, you can use something like this to create a new database

Dim strDBName As String
Dim dbNew as DAO.Database

strDBName = "D:\Folder\File.mdb"

Set dbNew = DBEngine.Workspaces(0).CreateDatabase( _
strDBName, dbLangGeneral)

and then
DoCmd.TransferDatabase to copy a table into the new database.
 
J

Jeff Boyce

Dar

Why, as in "why do you believe you need a new database created from an
existing one?" I'm not being facetious, I'm asking because there may be
another way to accomplish what you are trying to do using the route you
described.

Regards

Jeff Boyce
<Office/Access MVP>
 
D

DarS

I believe that will work thank you
--
Dar


John Nurick said:
In VBA, you can use something like this to create a new database

Dim strDBName As String
Dim dbNew as DAO.Database

strDBName = "D:\Folder\File.mdb"

Set dbNew = DBEngine.Workspaces(0).CreateDatabase( _
strDBName, dbLangGeneral)

and then
DoCmd.TransferDatabase to copy a table into the new database.
 
D

DarS

Jeff,
Our database creates a database with limited data and places it in a network
folder to be retrieved by third party software and then is moved to another
location by the third party. Our database needs to produce a new database
each time we give the dataset.

I believe the response above from John will work, but am open to suggestions
if you have another idea.
Thanks for the help
 
J

Jeff Boyce

Dar

Are you saying that a subset of your data needs to be used by another user
(or third-party software)?

Would it be appropriate/feasible to:
* create a query that returns the subset you need
* provide only that query to the other user(s)/software

Just a possibility...

Jeff Boyce
<Office/Access MVP>
 
D

DarS

Jeff,
Yes the subset is used by another user (third party).
The query would have given them the results they were looking for but they
need to be able to grab the whole data set and move it. They requested the
data set be in an Access db format.
Thanks for your help
 

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