By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,124 Members | 2,054 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,124 IT Pros & Developers. It's quick & easy.

Copy all tables from one database to another

P: n/a
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
Share this Question
Share on Google+
11 Replies


P: n/a
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

P: n/a
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

P: n/a
"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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
"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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.