Hi Guys
I am using Access 2007 and I have two accdb databases with linked tables. As I am closing the Front End accdb database I want to make a copy of the Master Table accdb database to a storage file elsewhere for safe keeping.
"FileCopy" works fine for unlinked stuff but refuses to work if the tables are linked.
Do I have to unLink the Master Table, tables prior to using "FileCopy" or is there a way to copy and paste the linked Master Table while it's active?
Thanks
Eric
14 4032 NeoPa 32,556
Expert Mod 16PB
Hi Eric.
I believe FileCopy can only work with files that have no lock on them - IE. are not open by anything - even for reading. In my experience that works when all linked tables, as well as QueryDefs, Forms, Reports, and Recordsets of course, have been closed.
The COPY command from CMD.EXE can also work even with files locked for writing, as long as they have no lock preventing reading. You can trigger that using the Shell command from VBA but you have to use CMD.EXE with the /C or /K switches in order to do so.
The standard approach is to make a backup copy of the backend database(s) containing the linked tables.
NeoPa 32,556
Expert Mod 16PB
The question's about trying to do that controlled by the Front End though. IE How & when can that be done when connecting to the database stops various sorts of copying.
Not sure I understand your point.
A backup copy of the backend database can easily be created using code from the frontend database
NeoPa 32,556
Expert Mod 16PB
Not using CopyFile if/when you have any linked tables open - according to the OP's OP.
I disagree with the comment.
A backup copy of a backup database can still be made when linked tables are open
Just to check my memory wasn't deceiving me I just ran a backup of an Access config BE with two linked tables open.
Before running the backup I edited records in each table as a further check
I used fso.CopyFile and it completed without error
NeoPa 32,556
Expert Mod 16PB
Ah. Excuse me. I got that detail wrong - but I was only quoting what was already in the OP. Apparently : EricB:
"FileCopy" works fine for unlinked stuff but refuses to work if the tables are linked.
Are you saying that isn't the case in your tests? Or have you not tested with what the OP was describing? Personally I simply took them at their word and explained the situation around locking of files in the hope that would help them with their issue.
Friends,
I accomplish this using a FileSystemObject as IslaDogs describes. It can force a copy, even if the file is in use. I have never experienced any issues.
Hi
I wrote a reply this morning but forgot to send it and it got 'lost' when my token expired.
I wrote the reply in post #3 as I have used FSO for many years to backup the backend database so I knew it worked whether or not any of the linked tables are open. Personally I see no point just copying an individual linked table.
However, I have also successfully tested that today using DoCmd.CopyObject whilst the linked table is open. However, 'copying' a linked table using that approach just creates a linked table in the destination database so that defeats the purpose of doing that as far as I am concerned.
Of course, it can then be converted to a local table in the destination database but that's a lot of fuss for no apparent gain in my opinion
NeoPa 32,556
Expert Mod 16PB
I think there's some misunderstanding of the question here. My understanding of the original request is to make a copy of the BE database file that contains the Master Table. Thus copying a file. fso.CopyFile is a valid answer to how one could do that but the real question also includes why does the FileCopy statement not work in some circumstances. Clearly they've fallen over when trying to make a backup copy of the database so, as well as pointing at a way that can be done without using FileCopy (CMD.Exe / COPY / Shell), I also explained what they could do to ensure the FE doesn't interfere with the backup if they were intent on using FileCopy .
Your suggestion to use fso.CopyFile as an alternative probably makes more sense to most people than the (CMD.Exe / COPY / Shell) one. All ideas that can add to the general understanding are valuable.
PS. It was really good to see you in Teams earlier getting set up & ready for the Access DevCon 2021 on Thursday.
PPS. I so hate it when I lose work after a token expires. My sympathies.
NeoPa,
The easy answer to the question as to why FileCopy won't work is that it doesn't work with files that are currently open/locked.
I am not smart enough to know why not, but, as you also agree and point out, fso.CopyFile does. Again, I can't explain why there is a difference, but there is. If the OP wants more than that, I cannot give it....
Hi Ade
The OP seems to have gone AWOL since post #1 so perhaps we should leave this until @EricB chooses to respond.
As we have already discussed above there are better alternatives which will work even if the table is open.
I'm looking forward to doing my short presentation at DevCon about my JSON Analyse & Transform for Access app.
Inevitably the problem is working out what to exclude so as to cover the basics in about 10 minutes or so.
I was planning to do detailed planning for this today but my kitchen fitter drilled through the power cables by mistake first thing this morning.
As a result, I spent most of the day fixing the issue and restoring the power! Ah well, tomorrow is another day .....
NeoPa 32,556
Expert Mod 16PB Colin:
I was planning to do detailed planning for this today but my kitchen fitter drilled through the power cables by mistake first thing this morning.
As a result, I spent most of the day fixing the issue and restoring the power! Ah well, tomorrow is another day
So all in all you've had a bit of a lucky day then. Power out and token expired all running smoothly into one fantastic day.
I look forward to catching your presentation :-)
LOL! All sorted now....& tomorrow is a detailed planning day
There's are many presentations I'm looking forward to at this year's DevCon.
However, I'm particularly interested in the Twin Basic session presented by Mike Wolfe based on work done by Wayne Phillips
Sign in to post your reply or Sign up for a free account.
Similar topics
by: laststubborn |
last post by:
Hi All;
We are going to change our application server. We will copy all of our
Database from Mic 2000 Server OS to Mic 2003 Server OS. I found an
article that how to move all the folders from...
|
by: Jerry Harris |
last post by:
Hello,
After copying a database to a new computer, a header using the
=Format$ stops working. Instead of displaying the field, the report
prompts me to "Enter paramater value for Format$. Any...
|
by: MeganF via AccessMonster.com |
last post by:
Hi.
I've been working on a database for a while now between my desktop and my
laptop. Each time I copy the files, I go into the Linked Table Manager and
update my path to my linked databases....
|
by: news.giganews.com |
last post by:
Does anyone know if there's an easy way to export or copy the relationship
structure from one mdb to a new one? The relationships in the db are time
consuming to reproduce. I am trying to make a...
|
by: bill.brennum |
last post by:
Hi,
Have a number of Access Databases that I inherited and want to zip a
few of them. My concern is that other active Microsoft Applications
may be linking to the database or its tables. Is...
|
by: aoao |
last post by:
I need to make a new database at the beginning of every year but have forgotten how to do this quickly and efficiently.
I have a database with about 10 tables, 10 forms related to the 10 tables...
|
by: egateway |
last post by:
I'm attempting to copy an exisiting Access Database file (.mdb) to be used as beginning design for a new database; however Design View, Save, and other controls are disabled; why?
Platform:...
|
by: raveenrs |
last post by:
Hi,
I'm new to DB2, having to move from a flat-file non-sql database to DB2. I'm currently trying to work out how to convert all our "custom" linux scripts to be compatible with DB2.
Currently,...
|
by: troy_lee |
last post by:
What is the best way of copying all the records from a linked table
into a replica table that is local on my computer? This is for
development work at home where I can not access the main table. Is...
|
by: Jonathan Wood |
last post by:
Greetings,
I've copied a significant database from an existing Website to a new one.
The database includes ASP.NET membership data.
I noticed that I am unable to successfully log on using any...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
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,...
|
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...
|
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
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
| |