473,387 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 12645
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*****@REMOVETHIScomcen.com.au> wrote in message
news:40******@nexus.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.TableDefs
for i = 0 to (myTD.Count - 1)
InTable = myTD(i).Name
OutTable = myTD(i).Name
OutDB = "c:\out.mdb"
docmd.copyobject 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*****@REMOVETHIScomcen.com.au> wrote in message
news:40******@nexus.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*****@REMOVETHIScomcen.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.TableDefs
for i = 0 to (myTD.Count - 1)
InTable = myTD(i).Name
OutTable = myTD(i).Name
OutDB = "c:\out.mdb"
docmd.copyobject 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*****@REMOVETHIScomcen.com.au> wrote in message
news:40******@nexus.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.ozemail.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*****@REMOVETHIScomcen.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.TableDefs
for i = 0 to (myTD.Count - 1)
InTable = myTD(i).Name
OutTable = myTD(i).Name
OutDB = "c:\out.mdb"
docmd.copyobject 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*****@REMOVETHIScomcen.com.au> wrote in message
news:40******@nexus.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*****@REMOVETHIScomcen.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.TableDefs
for i = 0 to (myTD.Count - 1)
InTable = myTD(i).Name
OutTable = myTD(i).Name
OutDB = "c:\out.mdb"
docmd.copyobject 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*****@REMOVETHIScomcen.com.au> wrote in message
> news:40******@nexus.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
I can create each relationship in code separately, but I seem to remember
that if I, say, ask for Attributes = dbRelationUpdateCascade +
dbRelationDeleteCascade and that relationship fails because someone has
managed to delete records such that the referential integrity is destroyed,
then no relationship is formed at all. In this case, I would need a simple
relationship without referential integrity to be created. But, because the
database is not with me, but out on a site somewhere, I have no way of
checking if the referential integrity failed or not. Is there a simple way
of in code, creating a normal relationship if referential integrity fails?

dixie

"dixie" <di****@dogmail.com> wrote in message
news:q2****************@nnrp1.ozemail.com.au...
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*****@REMOVETHIScomcen.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.TableDefs
> for i = 0 to (myTD.Count - 1)
> InTable = myTD(i).Name
> OutTable = myTD(i).Name
> OutDB = "c:\out.mdb"
> docmd.copyobject 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*****@REMOVETHIScomcen.com.au> wrote in message
> > news:40******@nexus.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 #11
It sounds as if you don't have a split frontend-backend database. If
you did, there would never be any "new features", etc. in the
back-end, and all you have to do is provide the users with a new
front-end.

Regards,
Krisa
Lyle Fairfield <Mi************@Invalid.Com> wrote in message news:<Xn*******************@130.133.1.4>...
"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

Nov 12 '05 #12

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

Similar topics

1
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...
4
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...
4
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...
4
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...
7
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...
4
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...
3
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...
2
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...
5
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. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...

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.