Dear reader,
How can I make a copy from a database which is in use.
If an mdb database is in use Access opens a small file with the extension
ldb.
This ldb file prohibits the execution of the following copy instruction:
FileCopy SourceFile, DestinationFile
The question is now, is there a possibility to make a copy of an in used mdb
file with a VBA code instruction.
Thanks for any help.
Kind regards,
Simon 7 12686
"Simon van Beek" <Sv********@Versatel.nlwrote in
news:48***********************@news.tele2.nl:
How can I make a copy from a database which is in use.
If an mdb database is in use Access opens a small file with the
extension ldb.
This ldb file prohibits the execution of the following copy
instruction:
Assuming Access Version >=2000
try
With CurrentProject
Shell "cmd /c copy """ & .FullName & """ """ & Replace(.FullName, .Name,
"NewName.mdb"""), vbHide
End With
The text "Shell ... vbHide" is one line of code.
--
lyle fairfield
On 29 Sep, 22:42, "Simon van Beek" <SvanBee...@Versatel.nlwrote:
Dear reader,
How can I make a copy from a database which is in use.
If an mdb database is in use Access opens a small file with the extension
ldb.
This ldb file prohibits the execution of the following copy instruction:
FileCopy SourceFile, DestinationFile
The question is now, is there a possibility to make a copy of an in used mdb
file with a VBA code instruction.
Thanks for any help.
Kind regards,
Simon
Try this:
Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal
lpExistingFileName _
As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long)
As Long
Sebastian C. Gr********@gmail.com wrote in
news:c0**********************************@z66g2000 hsc.googlegroups.co
m:
Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal
lpExistingFileName _
As String, ByVal lpNewFileName As String, ByVal bFailIfExists As
Long) As Long
This is *terrible* advice. All it does it get you around the very
smart prohibition hardwired into Access that prevents copying of an
open file. If the file is open, you can't guarantee that the result
will not be corrupt (or in an inconsistent but noncorrupt state) no
matter what method you use to copy via the file system.
The only way to safely copy is through Jet commands. Code for that
has been posted in the Access newsgroups many, many times, and
should be easily found via searching Google Groups.
--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
"David W. Fenton" <XX*******@dfenton.com.invalidwrote in
news:Xn**********************************@74.209.1 36.94: Gr********@gmail.com wrote in
news:c0**********************************@z66g2000 hsc.googlegroups.co
m:
>Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName _ As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long
This is *terrible* advice. All it does it get you around the very
smart prohibition hardwired into Access that prevents copying of an
open file. If the file is open, you can't guarantee that the result
will not be corrupt (or in an inconsistent but noncorrupt state) no
matter what method you use to copy via the file system.
The only way to safely copy is through Jet commands. Code for that
has been posted in the Access newsgroups many, many times, and
should be easily found via searching Google Groups.
I can't find this, David. I tried various combinations of copy, jet, open,
file, save and replicate.
Please, post code showing how you would do it.
--
lyle fairfield
On 1 Oct, 05:51, "David W. Fenton" <XXXuse...@dfenton.com.invalid>
wrote:
GrafixS...@gmail.com wrote innews:c0**********************************@z66g20 00hsc.googlegroups.co
m:
Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal
lpExistingFileName _
As String, ByVal lpNewFileName As String, ByVal bFailIfExists As
Long) As Long
This is *terrible* advice. All it does it get you around the very
smart prohibition hardwired into Access that prevents copying of an
open file. If the file is open, you can't guarantee that the result
will not be corrupt (or in an inconsistent but noncorrupt state) no
matter what method you use to copy via the file system.
The only way to safely copy is through Jet commands. Code for that
has been posted in the Access newsgroups many, many times, and
should be easily found via searching Google Groups.
--
David W. Fenton * * * * * * * * *http://www.dfenton.com/
usenet at dfenton dot com * *http://www.dfenton.com/DFA/
Yes, indeed, there is no guarantee for result yet it worked for me in
the last 5 years or so and never had any corrupt file.
In our application is a subroutine for a quick backup of a backend
file (before modifying data). This function was the only solution we
found for copying an open backend file.
Of course for a successfull operation one have to be sure there is no
adding, deleting or modifing data during the copying process.
Sebastian C. Gr********@gmail.com wrote in
news:0c**********************************@k30g2000 hse.googlegroups.co
m:
Yes, indeed, there is no guarantee for result yet it worked for me
in the last 5 years or so and never had any corrupt file.
In our application is a subroutine for a quick backup of a backend
file (before modifying data). This function was the only solution
we found for copying an open backend file.
Of course for a successfull operation one have to be sure there is
no adding, deleting or modifing data during the copying process.
It will work right up to the point at which it doesn't work.
I would not consider recommending such a routine to any of my
clients, since I consider it professional malpractice to gamble with
my clients' data, which is precisely what you're doing when you do
something that you are well aware can fail in some percentage of
cases.
--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
"Simon van Beek" <Sv********@Versatel.nlwrote:
>How can I make a copy from a database which is in use.
Why can't you wait until the MDB is no longer in use? If things are that critical
I'd suggest using SQL Server or other database software with similar 24x7
capabilities.
Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Grey |
last post by:
I have a ASP.NET web application which is required to copy file from windows
server to Novell Netware server. I have used impersonation to connect to
Netware server. The application works fine when...
|
by: MAF |
last post by:
Does anyone know why in 2005 I might be getting this error everytime I try
and recompile?
Error 226 Unable to copy file "obj\Debug\myfile.dll" to
"bin\Debug\myfile.dll". The process cannot...
|
by: MAF |
last post by:
Does anyone know why in 2005 I might be getting this error everytime I try
and recompile?
Error 226 Unable to copy file "obj\Debug\myfile.dll" to
"bin\Debug\myfile.dll". The process cannot...
|
by: Standist |
last post by:
I want install software on PC in my local network.
First I want copy file to the PC through default share like c$ or d$ on the
PC.
Then install the software through wmi.
I have the administrator...
|
by: vandanaj |
last post by:
hi everyone
i want to know how to copy file in asp
thanx in advance
|
by: Pivalig |
last post by:
Hello, i try to copy file from Pocket PC to network printer using this code :
destination = "\\\\pc1\\ep1000\\Bill.txt";
File.Copy("\\Program Files\\MobileKhelner\\Bill.txt", destination);
...
|
by: rizwan6feb |
last post by:
Hello everybody. I need help on how to use copy function to copy file from one computer to another ( or any other way i can copy the file). The computers are on a local network.
|
by: Irrigho5 |
last post by:
i have the open file function just need help with the copy file function and main
Ask for a source filename and a target filename. Then copy the source file to the target file using the...
|
by: foss |
last post by:
hi all,
I am not able to copy file from a directory in the server to another directory.
Here,
the source is outside the web root directory and the destination is inside the web root directory. ...
|
by: rajibdotnet |
last post by:
Till Date, I find no solution to the problem below.
Unable to copy file "obj\Debug\Tax2010.dll" to "bin\Tax2010.dll". The process cannot access the file 'bin\Tax2010.dll' because it is being used...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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:
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...
|
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...
|
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: 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,...
| |