PC Review


Reply
Thread Tools Rate Thread

Create new database on command from existing database

 
 
=?Utf-8?B?RGFyUw==?=
Guest
Posts: n/a
 
      18th Dec 2005
I have a table in an existing database that I would like to export to a new
database using an event procedure or macro. I would like to name the new
database with the date it is created. Any suggestions?
--
Dar
 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      18th Dec 2005
You can create the database like this:
Dim ws As DAO.Workspace
Dim dbBackup As DAO.Database
Dim strFile As String
strFile = "C:\" & Format(Date, "yyyymmnn") & ".mdb"
Set dbBackup = ws.CreateDatabase(strFile, dbLangGeneral)

You can then execute an Append query statement to add the table to the
database. Create a query using the table you want to export. Change it to an
Append query (Append on Query menu). Access gives you a dialog where you can
specify the name of the external file to export to.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"DarS" <(E-Mail Removed)> wrote in message
news:93B60EA4-6721-4C04-ABD4-(E-Mail Removed)...
>I have a table in an existing database that I would like to export to a new
> database using an event procedure or macro. I would like to name the new
> database with the date it is created. Any suggestions?
> --
> Dar



 
Reply With Quote
 
=?Utf-8?B?RGFyUw==?=
Guest
Posts: n/a
 
      18th Dec 2005
Thank you!
--
Dar


"Allen Browne" wrote:

> You can create the database like this:
> Dim ws As DAO.Workspace
> Dim dbBackup As DAO.Database
> Dim strFile As String
> strFile = "C:\" & Format(Date, "yyyymmnn") & ".mdb"
> Set dbBackup = ws.CreateDatabase(strFile, dbLangGeneral)
>
> You can then execute an Append query statement to add the table to the
> database. Create a query using the table you want to export. Change it to an
> Append query (Append on Query menu). Access gives you a dialog where you can
> specify the name of the external file to export to.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "DarS" <(E-Mail Removed)> wrote in message
> news:93B60EA4-6721-4C04-ABD4-(E-Mail Removed)...
> >I have a table in an existing database that I would like to export to a new
> > database using an event procedure or macro. I would like to name the new
> > database with the date it is created. Any suggestions?
> > --
> > Dar

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create new database from existing table Randy Van Sickle Microsoft Access Getting Started 6 27th Jan 2007 12:54 PM
Existing Database - Create new or Fix existing? =?Utf-8?B?QmV0YU1pa2U=?= Microsoft Access Queries 3 15th Jun 2006 12:36 PM
create a "template" database from existing (complex) database magpie Microsoft Access 2 14th Jun 2006 10:23 PM
how do I create a database that uploads to an existing one =?Utf-8?B?Sk1B?= Microsoft Access Database Table Design 0 21st Feb 2005 05:05 AM
Is it possible to use an existing database to create a new database Charlie Microsoft Access 1 13th Aug 2004 04:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:07 AM.