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

How to copy a file from within an access app to a CD drive

167 100+
I am using 'fs.copyfolder' to copy folder data to a network location, this is working fine. Now I need to write this folder and contents out to a cd drive instead of to the network. I have tried using fs.copyfile "c:\fileABC" to "d::\fileABC" (D is my drive for the cd writer). Has anybody written/copied files like this out of an access application?
Feb 26 '09 #1
3 1348
Stewart Ross
2,545 Expert Mod 2GB
Hi. Is there some reason why you cannot use Copyfolder once again?

I use the filesystem object to copy a database file from a live location to an off-line location on a different server. The bare code for doing so (without the setting of the from and to strings and all the user messages etc concerned) is extracted and listed below:

Expand|Select|Wrap|Line Numbers
  1. Dim fso As Object, f2 As Object
  2.     Dim strCopyFrom As String, strCopyTo As String
  3.     Set fso = CreateObject("Scripting.FileSystemObject")
  4.     ..<from and to strings need to be passed as parameters or otherwise set before use>..
  5.     Set f2 = fso.GetFile(strCopyFrom)
  6.     f2.Copy (strCopyTo)
  7.     Set fso = nothing
  8.     Set f2 = nothing
However, writing to a CD drive may be problematic, as the files may well need to be cached until you write them to the drive under manual control. It may well be better to write the folder to a temporary folder area and then transfer them to CD when your drive writing software is available under manual control...

-Stewart
Feb 26 '09 #2
ncsthbell
167 100+
Thanks for your reply. I am currently using the FSO method to copy the file from the C drive to a network drive. This works fine. The problem is that my users want me to copy the file to a cd disk 'automatically' in the code so they do not have to do this manally.
I substitued my 'to' location with the drive letter 'D:" (is the cd drive on my machine). I thought when the code was executed it would prompt me to put in a cd once it hit the copy code for the drive 'D', however, that is not what happens. Code just gets hung and does nothing.
Feb 27 '09 #3
Stewart Ross
2,545 Expert Mod 2GB
Hi. I haven't tried writing to a CD drive myself, so all I can do is to suggest that this is not likely to work as you expect. Writing to a rewritable CD or to a write-once CD-ROM does not work the same way as a hard disk or a flash drive, and I really doubt the the FSO routines were built for such drives. Hence why I reckoned that writing to such disks would be a manual process, and I advocated writing to a temporary folder instead (or a different medium).

At the very least, you are going to have to detect the state of the drive itself before you attempt to write to it, then figure out how to write the cached set of files to the drive. This is likely to involve calls to Windows API functions in one form or another, well beyond the use of the file system object itself I reckon.

-Stewart
Feb 27 '09 #4

Sign in to post your reply or Sign up for a free account.

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...
2
by: Greg | last post by:
looking for an easy way for users to browse for a file on their local drive, and then have access automatically make a copy of that file (files will most likely be images) and save it under a new...
3
by: David Altemir | last post by:
I have a table in MS Access 2003 that contains records that I would like to copy to the end of the table. There is one slight deviation from just doing a straightforwared COPY, however, in that I...
5
by: IdeaMan | last post by:
Windows 2000 Access 97 I am working on an issue tracking DB, where I need to link (not attach due to size)screen prints of various system errors. I have created a public folder on a network...
4
by: ShyGuy | last post by:
I have a routine that creates a new database and then copies a couple of tables to the new database as backups. It works fine but I want to split the database and run this routine from a machine...
3
by: Philipp Hänggi | last post by:
Hi How can I copy a File within an ASP.NET-Page. The location of the file is a Network-Drive. I tried File.copy but it doesn't work. The error is "Could not find file ...". Is there a...
2
by: 1388-2/HB | last post by:
On a W2K3 box running IIS 6 I have a web app that implements Forms Authentication mixed with AD (the login page autheticates users against AD & impersonates them with each page request). This...
25
by: Andy_Khosravi | last post by:
I just recently changed my database that I'm running from a monolithic DB to a split FE/BE. The front end resides on the client machine and the BE resides on a network drive. I'm experimenting with...
1
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
Using .NET 2.0 is it more efficient to copy files to a single folder versus spreading them across multiple folders. For instance if we have 100,000 files to be copied, Do we copy all of them to...
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
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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.