473,714 Members | 3,438 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Copy all tables from one database to another

If I wanted to be able to copy all of the tables in an existing database
called Original.mde to another database called New.mde from a button click
event in Original.mde, is there an easy way of coding it without naming
every single table in Original.mde. I am looking for a way of updating a
database on site without needing to access the database window and import
the existing tables into a new empty database.

dixie
Nov 12 '05 #1
11 12689
On Wed, 25 Feb 2004 15:37:43 +1100, "dixie" <di****@dogmail .com>
wrote:

Not sure why you're not just making a copy of the database. But that
aside, you can walk the TableDefs collection to find the names of all
tables.

-Tom.

If I wanted to be able to copy all of the tables in an existing database
called Original.mde to another database called New.mde from a button click
event in Original.mde, is there an easy way of coding it without naming
every single table in Original.mde. I am looking for a way of updating a
database on site without needing to access the database window and import
the existing tables into a new empty database.

dixie


Nov 12 '05 #2
Loop through the TableDefs collection and export each table... ?
--
Bradley
Software Developer www.hrsystems.com.au
A Christian Response www.pastornet.net.au/response

"dixie" <di****@dogmail .com> wrote in message
news:zF******** ********@nnrp1. ozemail.com.au. ..
If I wanted to be able to copy all of the tables in an existing database
called Original.mde to another database called New.mde from a button click
event in Original.mde, is there an easy way of coding it without naming
every single table in Original.mde. I am looking for a way of updating a
database on site without needing to access the database window and import
the existing tables into a new empty database.

dixie

Nov 12 '05 #3
"dixie" <di****@dogmail .com> wrote in news:zFV_b.174$ ud3.2855
@nnrp1.ozemail. com.au:
If I wanted to be able to copy all of the tables in an existing database
called Original.mde to another database called New.mde from a button click
event in Original.mde, is there an easy way of coding it without naming
every single table in Original.mde. I am looking for a way of updating a
database on site without needing to access the database window and import
the existing tables into a new empty database.


SaveAsText 6, "", FileName

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #4
You couldn't give me an example of this I suppose.

dixie

"Bradley" <br*****@REMOVE THIScomcen.com. au> wrote in message
news:40******@n exus.comcen.com .au...
Loop through the TableDefs collection and export each table... ?
--
Bradley
Software Developer www.hrsystems.com.au
A Christian Response www.pastornet.net.au/response

"dixie" <di****@dogmail .com> wrote in message
news:zF******** ********@nnrp1. ozemail.com.au. ..
If I wanted to be able to copy all of the tables in an existing database
called Original.mde to another database called New.mde from a button click event in Original.mde, is there an easy way of coding it without naming
every single table in Original.mde. I am looking for a way of updating a database on site without needing to access the database window and import the existing tables into a new empty database.

dixie


Nov 12 '05 #5
This is off the top of my head so I hope it works ok :)

dim myDB as TableDef
set myTD = CurrentDB.Table Defs
for i = 0 to (myTD.Count - 1)
InTable = myTD(i).Name
OutTable = myTD(i).Name
OutDB = "c:\out.mdb "
docmd.copyobjec t OutDB, InTable, acTable, OutTable
next

--
Bradley
Software Developer www.hrsystems.com.au
A Christian Response www.pastornet.net.au/response
"dixie" <di****@dogmail .com> wrote in message
news:un******** ********@nnrp1. ozemail.com.au. ..
You couldn't give me an example of this I suppose.

dixie

"Bradley" <br*****@REMOVE THIScomcen.com. au> wrote in message
news:40******@n exus.comcen.com .au...
Loop through the TableDefs collection and export each table... ?
--
Bradley
Software Developer www.hrsystems.com.au
A Christian Response www.pastornet.net.au/response

"dixie" <di****@dogmail .com> wrote in message
news:zF******** ********@nnrp1. ozemail.com.au. ..
If I wanted to be able to copy all of the tables in an existing database called Original.mde to another database called New.mde from a button click event in Original.mde, is there an easy way of coding it without naming every single table in Original.mde. I am looking for a way of
updating
a database on site without needing to access the database window and import the existing tables into a new empty database.

dixie



Nov 12 '05 #6
OK, thanks, I understand that. Am I Correct in presuming that this will not
bring the relationships with the tables? If not, is there a simple way of
doing it?

dixie

"Bradley" <br*****@REMOVE THIScomcen.com. au> wrote in message
news:s1******** **********@news-server.bigpond. net.au...
This is off the top of my head so I hope it works ok :)

dim myDB as TableDef
set myTD = CurrentDB.Table Defs
for i = 0 to (myTD.Count - 1)
InTable = myTD(i).Name
OutTable = myTD(i).Name
OutDB = "c:\out.mdb "
docmd.copyobjec t OutDB, InTable, acTable, OutTable
next

--
Bradley
Software Developer www.hrsystems.com.au
A Christian Response www.pastornet.net.au/response
"dixie" <di****@dogmail .com> wrote in message
news:un******** ********@nnrp1. ozemail.com.au. ..
You couldn't give me an example of this I suppose.

dixie

"Bradley" <br*****@REMOVE THIScomcen.com. au> wrote in message
news:40******@n exus.comcen.com .au...
Loop through the TableDefs collection and export each table... ?
--
Bradley
Software Developer www.hrsystems.com.au
A Christian Response www.pastornet.net.au/response

"dixie" <di****@dogmail .com> wrote in message
news:zF******** ********@nnrp1. ozemail.com.au. ..
> If I wanted to be able to copy all of the tables in an existing database > called Original.mde to another database called New.mde from a button

click
> event in Original.mde, is there an easy way of coding it without naming > every single table in Original.mde. I am looking for a way of

updating
a
> database on site without needing to access the database window and

import
> the existing tables into a new empty database.
>
> dixie
>
>



Nov 12 '05 #7
"dixie" <di****@dogmail .com> wrote in
news:Di******** *******@nnrp1.o zemail.com.au:
OK, thanks, I understand that. Am I Correct in presuming that this will
not bring the relationships with the tables? If not, is there a simple
way of doing it?


sigh ...

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #8
Wouldn't it be easier to just copy the entire file? It would preserve
the relationships.. .

Pavel

dixie wrote:

OK, thanks, I understand that. Am I Correct in presuming that this will not
bring the relationships with the tables? If not, is there a simple way of
doing it?

dixie

"Bradley" <br*****@REMOVE THIScomcen.com. au> wrote in message
news:s1******** **********@news-server.bigpond. net.au...
This is off the top of my head so I hope it works ok :)

dim myDB as TableDef
set myTD = CurrentDB.Table Defs
for i = 0 to (myTD.Count - 1)
InTable = myTD(i).Name
OutTable = myTD(i).Name
OutDB = "c:\out.mdb "
docmd.copyobjec t OutDB, InTable, acTable, OutTable
next

--
Bradley
Software Developer www.hrsystems.com.au
A Christian Response www.pastornet.net.au/response
"dixie" <di****@dogmail .com> wrote in message
news:un******** ********@nnrp1. ozemail.com.au. ..
You couldn't give me an example of this I suppose.

dixie

"Bradley" <br*****@REMOVE THIScomcen.com. au> wrote in message
news:40******@n exus.comcen.com .au...
> Loop through the TableDefs collection and export each table... ?
> --
> Bradley
> Software Developer www.hrsystems.com.au
> A Christian Response www.pastornet.net.au/response
>
> "dixie" <di****@dogmail .com> wrote in message
> news:zF******** ********@nnrp1. ozemail.com.au. ..
> > If I wanted to be able to copy all of the tables in an existing

database
> > called Original.mde to another database called New.mde from a button
click
> > event in Original.mde, is there an easy way of coding it without

naming
> > every single table in Original.mde. I am looking for a way of

updating
a
> > database on site without needing to access the database window and
import
> > the existing tables into a new empty database.
> >
> > dixie
> >
> >
>
>


Nov 12 '05 #9
The rest of the database would have been updated (as in a new version with
some fix or new feature), so it is not practical to just copy the file.
What I want to do is to import the old tables into the new database, getting
their relationships too. I know I can do this with a manual File --> Get
external data --> import, but I am trying to do it without the user needing
to go to the database window.

dixie

"Pavel Romashkin" <pa************ *@hotmail.com> wrote in message
news:40******** *******@hotmail .com...
Wouldn't it be easier to just copy the entire file? It would preserve
the relationships.. .

Pavel

dixie wrote:

OK, thanks, I understand that. Am I Correct in presuming that this will not bring the relationships with the tables? If not, is there a simple way of doing it?

dixie

"Bradley" <br*****@REMOVE THIScomcen.com. au> wrote in message
news:s1******** **********@news-server.bigpond. net.au...
This is off the top of my head so I hope it works ok :)

dim myDB as TableDef
set myTD = CurrentDB.Table Defs
for i = 0 to (myTD.Count - 1)
InTable = myTD(i).Name
OutTable = myTD(i).Name
OutDB = "c:\out.mdb "
docmd.copyobjec t OutDB, InTable, acTable, OutTable
next

--
Bradley
Software Developer www.hrsystems.com.au
A Christian Response www.pastornet.net.au/response
"dixie" <di****@dogmail .com> wrote in message
news:un******** ********@nnrp1. ozemail.com.au. ..
> You couldn't give me an example of this I suppose.
>
> dixie
>
> "Bradley" <br*****@REMOVE THIScomcen.com. au> wrote in message
> news:40******@n exus.comcen.com .au...
> > Loop through the TableDefs collection and export each table... ?
> > --
> > Bradley
> > Software Developer www.hrsystems.com.au
> > A Christian Response www.pastornet.net.au/response
> >
> > "dixie" <di****@dogmail .com> wrote in message
> > news:zF******** ********@nnrp1. ozemail.com.au. ..
> > > If I wanted to be able to copy all of the tables in an existing
database
> > > called Original.mde to another database called New.mde from a button > click
> > > event in Original.mde, is there an easy way of coding it without
naming
> > > every single table in Original.mde. I am looking for a way of
updating
> a
> > > database on site without needing to access the database window and > import
> > > the existing tables into a new empty database.
> > >
> > > dixie
> > >
> > >
> >
> >
>
>

Nov 12 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6070
by: | last post by:
I am trying to find the best way to copy specific tables from one database to another when the source and target database names are not always the same. Can you use variables to specify (or prompt the user) to provide source and target databases? The target database will exist with the the same tables as the source. The tables to copy will always be the same. Example: UserA wants to copy 10 tables from Data1 to Data2 UserB wants to...
4
4756
by: oceanhai | last post by:
We currently have a PPTP connection set up for our developers to access our development SQL server through a VPN tunnel. When they need to copy tables up to the dev SQL from their local machine they simply do a DTS copy. However, we are now moving to a thin client solution where they will be working on a terminal server. They will have access to the development SQL servers and SQL tools such as EM and QA. However, they will not have...
4
2057
by: sparks | last post by:
1 need to copy the data in one table into another...but its from another database. tables are demographics and testdata database1 database2 demographics personid personid same in both databases eval eval same in both databases autoid autoid different testdata
4
2301
by: ShyGuy | last post by:
I have a routine that creates a new database and then copies a couple of tables to the new database as backups. It works fine but I want to split the database and run this routine from a machine that does not have the actual tables on it. I am using the following DoCmd.TransferDatabase acExport, "Microsoft Access", "Backup.mdb", acTable, "TableName", "TableName" Is there a way to use this and get the tables from a different machine?
7
11627
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard is proving to be more difficult. These pictureboxes are bound to an AccessDB. If the user wants to add an image, they select an image using an OpenFileDialog: Dim result As DialogResult = Pic_Sel.ShowDialog() If (result = DialogResult.OK) Then
4
2479
by: JIM.H. | last post by:
Hello, I am trying to write the data I got from a web service to my table in SQL Server I need to append the dataset wsDS to the dataset ds and do update. PVS.myWS.Loader load = new PVS.myWS.Loader(); DataSet wsDS=load.WsLoad(); dataGrid1.DataSource=wsDS; string strConn = ConfigurationSettings.AppSettings;
3
2189
by: Jim | last post by:
Hi All. I'm working with a group of remote users and need to send them updated tables, queries, forms and reports on a weekly basis. What I do is create a separate little database with all the new items in it, and then do an autoexec macro that does the CopyObject action on each one of them, but to do this, I have to edit the macro a lot and if I have 30 objects in the database that need copying, I have to have the CopyObject action in...
2
3465
by: Swinky | last post by:
I hope someone can help...I feel like I'm walking in the dark without a flashlight (I'm NOT a programmer but have been called to task to do some work in Access that is above my head). I have code that will successfully copy a record and append the information to a new record in the same table (parent table) within a form. However, there are related child tables with primary keys (set to Autonumber) stored in sub-forms. That information...
5
34047
by: Steve | last post by:
Hi; I thought I would rephrase a question I asked in another post to more quickly get to the heart of the matter. My apologies for anyone who is offended by what appears to be a repetition. My company has two identical web sites. One copy is for our customer, and one copy is for us to test our code changes on. We developed a hard to isolate bug in the copy of the web stie for our
0
8713
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9318
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9187
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9079
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7957
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6638
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4730
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2113
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.