473,473 Members | 2,316 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Copy all objects to another db

Hi all,
I have a situation where I (have to) develop a database together with some other person.
Let's say we have develop1.mdb and develop2.mdb
We need to work on different 'pieces' of the app.
For testing purposes I need to 'merge' these two together to another database "Final.mdb"
Happily there will be no problem with object-names. (I use a naming convention, other developer does not)

From develop2.mdb I have code to
-- copy develop1.mdb to final.mdb (I delete the previous version first)
-- copy all objects from develop2.mdb to the new created develop.mdb

All works fine but is is slow... (> 2 minutes to copy about 200 objects)
To copy all object I use code like the following:
'This is code to copy the tables only, I do similar for forms, reports, query's and modules

Set db = CurrentDb
strSql = "SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],1)<>'~')"
strSql = strSql & " AND Left$([Name],4)<>'Msys'"
strSql = strSql & " AND (MSysObjects.Type)=1 ORDER BY MSysObjects.Name"
Set rst = db.OpenRecordset(strSql)
Do Until rst.EOF
'Debug.Print rst!Name
DoCmd.CopyObject strDestmdb, rst!Name, acTable, rst!Name
rst.MoveNext
Loop

Any ideas to improve this are welcome.

Arno R

Nov 13 '05 #1
4 5875
You might check out a tool at my site called CopyWiz. It's free, and
doesn't really speak to your situation exactly, but the code behind
the tool might be usefu.
http://amazecreations.com/datafast/
go to downloads and look for Copy Wiz
--

Danny J. Lesandrini
dl*********@hotmail.com


"Arno R" <ar***********@tiscali.nl> wrote ...
Hi all,
I have a situation where I (have to) develop a database together with some other person.
Let's say we have develop1.mdb and develop2.mdb
We need to work on different 'pieces' of the app.
For testing purposes I need to 'merge' these two together to another database "Final.mdb"
Happily there will be no problem with object-names. (I use a naming convention, other developer does not)

From develop2.mdb I have code to
-- copy develop1.mdb to final.mdb (I delete the previous version first)
-- copy all objects from develop2.mdb to the new created develop.mdb

All works fine but is is slow... (> 2 minutes to copy about 200 objects)
To copy all object I use code like the following:
'This is code to copy the tables only, I do similar for forms, reports, query's and modules

Set db = CurrentDb
strSql = "SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],1)<>'~')"
strSql = strSql & " AND Left$([Name],4)<>'Msys'"
strSql = strSql & " AND (MSysObjects.Type)=1 ORDER BY MSysObjects.Name"
Set rst = db.OpenRecordset(strSql)
Do Until rst.EOF
'Debug.Print rst!Name
DoCmd.CopyObject strDestmdb, rst!Name, acTable, rst!Name
rst.MoveNext
Loop

Any ideas to improve this are welcome.

Arno R
Nov 13 '05 #2
I wonder if you couldn't do this faster "by hand" -
just use the wizard to import all objects from first one, then the other
database...
(you can use options to import relationships, toolbars, etc. without
writing code, too)

HTH

"Arno R" <ar***********@tiscali.nl> wrote in message
news:43********************@dreader2.news.tiscali. nl...
Hi all,
I have a situation where I (have to) develop a database together with some
other person.
Let's say we have develop1.mdb and develop2.mdb
We need to work on different 'pieces' of the app.
For testing purposes I need to 'merge' these two together to another
database "Final.mdb"
Happily there will be no problem with object-names. (I use a naming
convention, other developer does not)

From develop2.mdb I have code to
-- copy develop1.mdb to final.mdb (I delete the previous version first)
-- copy all objects from develop2.mdb to the new created develop.mdb

All works fine but is is slow... (> 2 minutes to copy about 200 objects)
To copy all object I use code like the following:
'This is code to copy the tables only, I do similar for forms, reports,
query's and modules

Set db = CurrentDb
strSql = "SELECT MSysObjects.Name FROM MsysObjects WHERE
(Left$([Name],1)<>'~')"
strSql = strSql & " AND Left$([Name],4)<>'Msys'"
strSql = strSql & " AND (MSysObjects.Type)=1 ORDER BY MSysObjects.Name"
Set rst = db.OpenRecordset(strSql)
Do Until rst.EOF
'Debug.Print rst!Name
DoCmd.CopyObject strDestmdb, rst!Name, acTable, rst!Name
rst.MoveNext
Loop

Any ideas to improve this are welcome.

Arno R
Nov 13 '05 #3

"MacDermott" <ma********@nospam.com> schreef in bericht news:yD*******************@newsread2.news.atl.eart hlink.net...
I wonder if you couldn't do this faster "by hand" -
just use the wizard to import all objects from first one, then the other
database...
(you can use options to import relationships, toolbars, etc. without
writing code, too)

HTH


Thanks, but I would rather do this 'automated'
I might try the other way around.
I am getting the idea that importing works way faster than exporting.

Arno R
Nov 13 '05 #4

"Danny J. Lesandrini" <dl*********@hotmail.com> schreef in bericht news:ec********************@comcast.com...
You might check out a tool at my site called CopyWiz. It's free, and
doesn't really speak to your situation exactly, but the code behind
the tool might be usefu.
http://amazecreations.com/datafast/
go to downloads and look for Copy Wiz
--

Danny J. Lesandrini
dl*********@hotmail.com


I looked at the CopyWiz.mdb.
Basically it works the same (also uses docmd.CopyObject) but it is also slow, even slower actually.
This CopyWiz-code uses 3 mdb's if I am right.
First imports object from A.mdb to CurrentDb, then exports.to B.mdb and deletes the object again from CurrentDb.
It works perfect and it certainly has it's advantages, but in my case it is not the solution I am seeking.

I might try the other way around though. It may be the case that importing objects is faster than exporting.
I will also test SaveAsText - LoadFromText routines.

Your code might be useful in 'controlling' multiple open mdb's.
Thanks,

Arno R
Nov 13 '05 #5

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

Similar topics

42
by: Edward Diener | last post by:
Coming from the C++ world I can not understand the reason why copy constructors are not used in the .NET framework. A copy constructor creates an object from a copy of another object of the same...
15
by: A | last post by:
Hi, A default copy constructor is created for you when you don't specify one yourself. In such case, the default copy constructor will simply do a bitwise copy for primitives (including...
16
by: bluekite2000 | last post by:
I want Matrix A(B) to create shallow copy of B but A=B to create deep copy of B. Is that bad design? Why and why not?
7
by: Harag | last post by:
Hi all If I create an object with the following: var ob1 = new objMyDefinedObject(); then I assign it to a new variable. var ob2 = ob1
4
by: OpticTygre | last post by:
If I pass an object to another form via the new form's tag property, I want to create an object exactly like it, with it's properties and all, but have it be a copy of the object passed through,...
10
by: utab | last post by:
Dear all, So passing and returning a class object is the time when to include the definition of the copy constructor into the class definition. But if we don't call by value or return by value, ...
13
by: blangela | last post by:
I have decided (see earlier post) to paste my Word doc here so that it will be simpler for people to provide feedback (by directly inserting their comments in the post). I will post it in 3 parts...
10
by: JurgenvonOerthel | last post by:
Consider the classes Base, Derived1 and Derived2. Both Derived1 and Derived2 derive publicly from Base. Given a 'const Base &input' I want to initialize a 'const Derived1 &output'. If the...
13
by: Jeroen | last post by:
Hi all, I'm trying to implement a certain class but I have problems regarding the copy ctor. I'll try to explain this as good as possible and show what I tried thusfar. Because it's not about a...
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.