Create New database

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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.
 
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>
 
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.
 
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
 
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>
 
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
 
Back
Top