473,671 Members | 2,290 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Copy a File

I need to copy a file in a VBA module of an Access form, and I
haven't been able to find out how to do it: just

cp /Path1/file1 /Path2/file2
[my UNIX is showing]

Please show me how to do this in VBA for Windows.

thanks, --thelma
Oct 21 '06 #1
4 4342
Thelma Lubkin wrote:
I need to copy a file in a VBA module of an Access form, and I
haven't been able to find out how to do it: just

cp /Path1/file1 /Path2/file2
[my UNIX is showing]

Please show me how to do this in VBA for Windows.

thanks, --thelma
There is a command named "FileCopy".

FileCopy "source path" "destinatio n path"

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Oct 21 '06 #2
Rick Brandt wrote:
Thelma Lubkin wrote:
I need to copy a file in a VBA module of an Access form, and I
haven't been able to find out how to do it: just

cp /Path1/file1 /Path2/file2
[my UNIX is showing]

Please show me how to do this in VBA for Windows.

thanks, --thelma

There is a command named "FileCopy".

FileCopy "source path" "destinatio n path"
moving a file ...

Name "source path" As "destinatio n path"

(don't know if the documenation supports this use but it seems to work)

Oct 21 '06 #3
"Lyle Fairfield" <ly***********@ aim.comwrote in
news:11******** **************@ e3g2000cwe.goog legroups.com:
Rick Brandt wrote:
>Thelma Lubkin wrote:
I need to copy a file in a VBA module of an Access form, and I
haven't been able to find out how to do it: just

cp /Path1/file1 /Path2/file2
[my UNIX is showing]

Please show me how to do this in VBA for Windows.

thanks, --thelma

There is a command named "FileCopy".

FileCopy "source path" "destinatio n path"

moving a file ...

Name "source path" As "destinatio n path"

(don't know if the documenation supports this use but it seems to work)
In Access 97:

Both newpathname and oldpathname must be on the same drive. If the path in
newpathname exists and is different from the path in oldpathname, the Name
statement moves the file to the new directory or folder and renames the
file, if necessary. If newpathname and oldpathname have different paths and
the same file name, Name moves the file to the new location and leaves the
file name unchanged. Using Name, you can move a file from one directory or
folder to another, but you can't move a directory or folder.

Using Name on an open file produces an error. You must close an open file
before renaming it. Name arguments cannot include multiple-character (*)
and single-character (?) wildcards.

Cheers,
Alan
Oct 23 '06 #4
Rick Brandt <ri*********@ho tmail.comwrote:
: Thelma Lubkin wrote:
: I need to copy a file in a VBA module of an Access form, and I
: haven't been able to find out how to do it: just
:>
: cp /Path1/file1 /Path2/file2
: [my UNIX is showing]
:>
: Please show me how to do this in VBA for Windows.
:>
: thanks, --thelma

: There is a command named "FileCopy".

: FileCopy "source path" "destinatio n path"

Thank you. This command allows me to overwrite an existing
/Path2/file2, which is what I want to do.

I ran into a problem while testing my use of it. I am copying an
Excel workbook that I use as an informal template to a file specified
by the Access form's user. I had set a breakpoint right after I opened
the new file and then did an immediate reset. After looking to assure
myself that the filecopy had indeed worked, I ran the form again: this
time filecopy erred out with a "Permission denied" message.

Ah, FileCopy won't overwrite open files. Ok, I deleted the supposedly open
workbook and tried again: "Permission denied". I exited Access, came
back in, tried again: "Permission denied". I couldn't get it to forget
that 'open file' until I exited the system and logged back on.

I don't know how to get around this problem, nor do I know whether
it's a problem within Access, VBA, Excel, or most probably, my tangled
operating system situation. I'm logging onto a University network of
PC's to use Access, but I store my data and results on a Unix machine,
so all kinds of disk mapping is going on. I'd appreciate suggestions
[other than the obvious 'why bring in Unix?']

--thanks, thelma
: --
: Rick Brandt, Microsoft Access MVP
: Email (as appropriate) to...
: RBrandt at Hunter dot com
Oct 24 '06 #5

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

Similar topics

19
4659
by: Claudio Grondi | last post by:
I would like to save time copying the same file (>6 GByte) to various different target storage media connected to the system via USB. Is there a (Python or other) tool able to help me to do this, so that I don't need to copy the source file first to the first media, then to the second, etc.? Claudio
0
2091
by: SeanR | last post by:
I have a function to copare two files. It will first copy the original file form a different server to a local temp path and then compare that version to a version that has been restored form tape. Once the compare is complete the file that was copied to a temp location needs to be deleted. I am using the method file.copy(sourcePath, tempPath, true) to copy the file and then file.delete(tempPath) to delete the file. On some of the files...
0
1695
by: Joshua Ginsberg | last post by:
Howdy -- I have a class that has an attribute that is a dictionary that contains an object that has a kword argument that is a lambda. Confused yet? Simplified example: import copy class Foo: def __init__(self, fn=None):
5
1896
by: DraguVaso | last post by:
Hi, I need a SECURE way to copy parts of a file. I'm having files which contains a whole bunch of records. In one 'fysical' file I'm having one or more logical files. What I need to do is to copy a logical file (a part of the fysical file) into a new file. But the 'big' problem is: these records contains bankstatements, so I can't take the risk that there would be a record missing, or even one little charachter. The copy I make has to...
8
2925
by: luis molina Micasoft | last post by:
it seems that when i do file.copy the svchost.exe is hanged, i mean if i make 40 threads of file.copy , 40 copys of files at same time the system is going down and stop responding, this is when i'm working with cifs (shares). there is another solution to copy files than file.copy in .net?
7
11615
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard is proving to be more difficult. These pictureboxes are bound to an AccessDB. If the user wants to add an image, they select an image using an OpenFileDialog: Dim result As DialogResult = Pic_Sel.ShowDialog() If (result = DialogResult.OK) Then
4
3675
by: Emin | last post by:
Dear experts, I got some unexpected behavior in getattr and copy.deepcopy (see transcript below). I'm not sure if this is actually a bug in copy.deepcopy or if I'm doing something too magical with getattr. Comments would be appreciated. Thanks, -Emin
1
1880
by: ajc308 | last post by:
I'm attempting to sort the <file>s within each <directory> in my XML according to their file extension, then write out the resulting sorted data back to XML format. I had it working before, and when I opened up the file the next day, the XSL behaved completely different. I don't know if I accidentally changed something, but I can't see any problems with my code. My Sample XML: <root name="PlanRepository"> <directory name="connoraj">...
3
12837
by: maheshkadam | last post by:
Hi friends I am new to perl so please guide me. I have one application which created backup log file every day.But it appends that file so you can see logs for different day in one file only. My requirement is to copy backup log for the specific day (yesterday) and write in other file. That file will be mailed to admin for ready reference. So here is some text from that log file
0
8390
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8911
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...
0
8819
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8667
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
7428
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...
0
4222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4402
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2808
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
2048
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.