473,804 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
+ 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.Nam e FROM MsysObjects WHERE (Left$([Name],1)<>'~')"
strSql = strSql & " AND Left$([Name],4)<>'Msys'"
strSql = strSql & " AND (MSysObjects.Ty pe)=1 ORDER BY MSysObjects.Nam e"
Set rst = db.OpenRecordse t(strSql)
Do Until rst.EOF
'Debug.Print rst!Name
DoCmd.CopyObjec t strDestmdb, rst!Name, acTable, rst!Name
rst.MoveNext
Loop

Any ideas to improve this are welcome.

Arno R

Nov 13 '05 #1
4 5905
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*********@hot mail.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.Nam e FROM MsysObjects WHERE (Left$([Name],1)<>'~')"
strSql = strSql & " AND Left$([Name],4)<>'Msys'"
strSql = strSql & " AND (MSysObjects.Ty pe)=1 ORDER BY MSysObjects.Nam e"
Set rst = db.OpenRecordse t(strSql)
Do Until rst.EOF
'Debug.Print rst!Name
DoCmd.CopyObjec t 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******** ************@dr eader2.news.tis cali.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.Nam e FROM MsysObjects WHERE
(Left$([Name],1)<>'~')"
strSql = strSql & " AND Left$([Name],4)<>'Msys'"
strSql = strSql & " AND (MSysObjects.Ty pe)=1 ORDER BY MSysObjects.Nam e"
Set rst = db.OpenRecordse t(strSql)
Do Until rst.EOF
'Debug.Print rst!Name
DoCmd.CopyObjec t strDestmdb, rst!Name, acTable, rst!Name
rst.MoveNext
Loop

Any ideas to improve this are welcome.

Arno R
Nov 13 '05 #3

"MacDermott " <ma********@nos pam.com> schreef in bericht news:yD******** ***********@new sread2.news.atl .earthlink.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*********@ho tmail.com> schreef in bericht news:ec******** ************@co mcast.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*********@hot mail.com


I looked at the CopyWiz.mdb.
Basically it works the same (also uses docmd.CopyObjec t) 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
5816
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 kind. It sounds simple but evidently .NET has difficulty with this concept for some reason. I do understand that .NET objects are created on the GC heap but that doesn't mean that they couldn't be copied from another object of the same kind when...
15
21206
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 pointers) and for objects types call their default constructor. Any others points i should know?
16
3146
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
2221
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
1445
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, and not just a reference to the object. Example: Public Sub Form_Load(ByVal sender as Object, ByVal e as EventArgs) Dim obj as Object = Activator.CreateInstance(Me.Tag.GetType())
10
2585
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, we do not need to use the copy-constructor. So depending on the above reasoning I can avoid call by value and return by value for class objects, this bypasses the problem or it seems to me like that. Could any one give me some simple examples...
13
5027
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 to make it more manageable. Below is a draft of a document that I plan to give to my introductory C++ class. Please note that I have purposely left out any mention of safety issues in the ctors which could be resolved thru some combination...
10
3453
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 dynamic type of 'input' is Derived1, then 'output' should become a reference to 'input'. Otherwise 'output' should become a reference to the (temporary) result of the member function 'input.to_der1()' which returns a Derived1 object by value.
13
2483
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 certain code syntax but more a 'code architecture' thing , I'll use simple example classes (which are certainly not complete or working...) just to illustrate the idea (and I may make some mistakes because I'm not that experienced...). The...
0
9715
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10600
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...
1
10354
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
10097
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9175
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
7642
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
6867
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4313
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 we have to send another system
2
3835
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.