473,395 Members | 1,537 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,395 software developers and data experts.

Making a copy of the current database using code

In the database that I am creating I need to be able to rename the file
with a name that the user specifies using the Save As Dialog window (I
already have the code that brings up this window). In other words, I
need to write code that makes a copy of the current database and saves
it with a new name. I've read that it is a bad idea to copy a file
that is currently in use so I am at a loss of what I should do. Any
suggestions?

May 30 '06 #1
10 8233
We cannot tell from what you have told us, However,

Is this a split application (ie. BE and FE)

Are you trying to backup the data or the forms?

If it is a FE and BE, renaming the BE will destroy the links, You would
have to copy it and rename the copy. Also it will probably NOT allow
you to rename the mdb you are in anyway. Usually it will allow a copy
but not a rename. Consequently SaveAs is probably not the way to go
since it says you have to have the mdb open and if it is the FE that
you are saving as it does nothing about the data.

Copy of the BE runs the risk of copying right in the middle of an
update so that at least the copy may be corruped. The only way to
forstall that is that everyone would have to be out of the BE when it
was done.

May 30 '06 #2
Thanks for the reply. It is not a backup that I am trying to create,
it will will eventually become a seperate database that users will
access. The purpose of my database is somewhat complex...I am creating
a database that provides a simple and easy way for people to load their
data into it and actually create a new database for them (all for the
same purpose mind you, but different data). I thought the best way to
go about this was to have them load the data required into this main
database and then copy the database with a new name. I originally
planned to have a blank database open and just export the data into it
but I thought this would be an easier solution. Probably not though.

May 30 '06 #3

Ja************@ge.com wrote:
Thanks for the reply. It is not a backup that I am trying to create,
it will will eventually become a seperate database that users will
access. The purpose of my database is somewhat complex...I am creating
a database that provides a simple and easy way for people to load their
data into it and actually create a new database for them (all for the
same purpose mind you, but different data). I thought the best way to
go about this was to have them load the data required into this main
database and then copy the database with a new name. I originally
planned to have a blank database open and just export the data into it
but I thought this would be an easier solution. Probably not though.


Sorry for the new topic line. It won't let me respond normally.

You still haven't told us if this is a BE/FE situation, because that
will determine the type of response we can offer, and allow us to
indicate pitfalls to watch for.

May 31 '06 #4
Study up on Replication/Synchronization. If you want to make multiple
copies, and allow users to enter data into the different copies, and
integrate all that back into a master somewhere, this is the way to do it.
If you synchronize all of them over time you wind up with all the data in
all the copies. If you get data from one copy back into the master and
you're finished with the copy for good, you can just delete it. Access
master doesn't care about whether any of the copies still exist or not.

It's very easy to set up.
May 31 '06 #5
"Rick Wannall" <wa*****@sbcglobal.net> wrote in
news:mN*******************@newssvr11.news.prodigy. com:
Study up on Replication/Synchronization. . . .
No, this really has nothing to do with the question being asked.
. . . If you want to make multiple
copies, and allow users to enter data into the different copies,
and integrate all that back into a master somewhere, this is the
way to do it.
Assuming you have a split architecture where you're replicating only
the data, that's one solution to the problem you describe, but it
only works if the individual users can connect to a common network,
or a chain of networks (A->B->C->B->A, where C does not have to be
able to connect directly to A, but there has to be a path from C to
A through an intervening network connection).
If you synchronize all of them over time you wind up with all the
data in all the copies. If you get data from one copy back into
the master and you're finished with the copy for good, you can
just delete it.
This is just so much complete bullshit. Access/Jet *does* care if
you delete the source replica, as it has a record of it.
. . . Access
master doesn't care about whether any of the copies still exist or
not.
Yes, Jet *does* care. Any replica that participates in a synch is
then known to every other replica and the list of replicas is
maintained in perpetuity until you delete the replica from the
replica set (something that can only be done by attempting a synch
with the deleted replica, which means the network path has to be
accessible). Deleting replicas can lead to data errors, data
corruption and eventual loss of the entire replica set. At the very
least, once it develops, you can't say for certain whether or not
the synched replicas are actually identical or not, so the data
might as well be corrupted, since it's no longer reliable.
It's very easy to set up.


And you are clearly a moron who knows absolutely nothing about
actually using Jet replication over the long term.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
May 31 '06 #6
Sorry, we just haven't had the kind of difficulties using it that you seem
to experience.

OP: If you set this up properly, it works great.
May 31 '06 #7
Thanks all for responding. I don't think that synchronization is
necessary in what I am trying to do mainly because the data does not
need to be integrated back to the master. Each database that is
created from the master will be a stand alone environment so my main
problem is in creating the copy of the database. Right now I am
creating a split database (with both a FE and BE) that needs to be
copied and turned into a seperate database or be able to
programatically export the data that the user enters into the master
into a blank database that the user names. The more I think about it
the more the latter makes more sense.

May 31 '06 #8
"Rick Wannall" <wa*****@notadomain.de> wrote in
news:tw*******************@newssvr11.news.prodigy. com:
Sorry, we just haven't had the kind of difficulties using it that
you seem to experience.
The difficulties will happen to anyone who deletes replicas in the
file system without deleting them from the replica set.

Your replica set is unreliable, as you can't say if the data is
actually synching completely.
OP: If you set this up properly, it works great.


You're lying. You would have had the problems if you had done what
you are recommending.

I've been doing Jet replication since 1997 and I've seen it all. If
you actually were doing what you've recommended, then your replica
set would be corrupted, whether you know that fact or not.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
May 31 '06 #9
Ja************@ge.com wrote:
I need to write code that makes a copy of the current database and saves
it with a new name.


Air Code:

Public Sub CopyMe(ByVal NewMe As String)
Dim o As AccessObject
SaveAsText 6, "", NewMe
With CurrentProject
For Each o In .AllForms
With o
DoCmd.CopyObject NewMe, .Name, acForm, .Name
End With
Next o
For Each o In .AllMacros
With o
DoCmd.CopyObject NewMe, .Name, acMacro, .Name
End With
Next o
For Each o In .AllModules
With o
DoCmd.CopyObject NewMe, .Name, acModule, .Name
End With
Next o
For Each o In .AllReports
With o
DoCmd.CopyObject NewMe, .Name, acReport, .Name
End With
Next o
End With
For Each o In CurrentData.AllQueries
With o
DoCmd.CopyObject NewMe, .Name, acQuery, .Name
End With
Next o
End Sub

Sub test()
CopyMe "temp.mdb"
End Sub

Jun 1 '06 #10
Keep in mind that if you are trying to make a copy of a BE-FE set, you
will ALSO have to change all of the linked references in the copied FE
to now point to the newly created BE.

If you don't do that then allyou have done is create a backup of the BE
and another FE pointing to your current BE and not the new BE.

Jun 1 '06 #11

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

Similar topics

0
by: |-|erc | last post by:
Hi! Small challenge for you. The index.php uses this file and calls layout(). Take a look at www.chatty.net this file draws the chat login box on the right. I traced the CHAT button it submits...
1
by: Andy | last post by:
I have 2 databases, one that we use called MyShop and one that I develop on called TestShop. After I have a stored procedure working the way I want in TestShop , is there a way to just copy the SP...
2
by: jon.brookins | last post by:
Hello everyone! I'd like to know which method is better for making a copy of an existing database in SQL Server 2000, restoring from a backup of the original, or using DTS to copy the objects to...
6
by: Shyguy | last post by:
I want to create two buttons on a form. One would allow the user to Copy the contents of the current records memo field, the other would allow them to print. I set up a report based on the memo...
7
by: Wysiwyg | last post by:
Is there any way to add an embedded resource to a project without copying it to the project's directory? I have shared resources and don't want each project using the images, xml files, etc. to...
12
by: alanchinese | last post by:
i am a db2 newbie. we have a server hosting a db2/6000 database that restricts the use of backup, generate ddl. i wonder if there is a simple way to transfer the database structure and data into my...
3
by: markww | last post by:
Hi, I have a wrapper around some 3rd party database library function. The pseudo code looks like the following - it is meant to open a table in a database, extract values from a table, then copy...
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. ...
7
by: mishrarajesh44 | last post by:
hii all Truly telling i hav got this code from net & i am finding error while running the code below.. code:- <?php $idir = "photo/"; // Path To Images Directory $tdir =...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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...
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...

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.