473,779 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FileCopy Problem

32 New Member
In my app I am creating, there is a procedure that does a file copy from the local drive to a network share. The issue I am having, is even though I have the share mapped, and I can browse to the share with no problems, when ever the procedure is run, I get a Permission Denied error.

When I get this error, I click on Debug and find the line causing the error which is my file copy line. If I click continue, the code sequence finishes and the file is copied out to the network share. I have no clue what is causing this issue or how to fix it. Is there a possible way of suppressing the error and having it just continue on with the next line?

The code procedure is as follows"
Expand|Select|Wrap|Line Numbers
  1. 'Set data paths. Where file is located and location to copy data
  2.     DestName1 = "X:\PDF\"
  3.     DirName1 = "C:\portfolio\TEMPDATA\"
  4.     nextbookA = Dir(DirName1 & "*.pdf")
  5.    If nextbookA <> "" Then
  6.    FileCopy DirName1 & nextbookA, DestName1 & nextbookA
  7.    Kill DirName1 & nextbookA
  8.    End If
  9.  
This line:
FileCopy DirName1 & nextbookA, DestName1 & nextbookA

is the line it crashes on
Apr 2 '08 #1
7 6133
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Hi. It would undoubtedly be better to find the cause of your error and resolve this. I'm sorry to say I have no more idea what it might be than you.

As a work around at present you can indeed get VBA to ignore errors; at the top of the sub or function which is doing the copy just add:
Expand|Select|Wrap|Line Numbers
  1. On Error Resume Next
If there is an existing On Error statement you can override it with On Error Resume Next just before the copy then insert another version of the original On Error redirect afterwards to ensure that other errors are trapped as necessary.

-Stewart
Apr 3 '08 #2
jimatqsi
1,277 Recognized Expert Top Contributor
Hi. How have you logged on? Are you logged on as an Administrator? I think the answer will lie in user privileges. Try changing the destination location to be somewhere in your My Documents folder. I bet that will be successful. Meanwhile, I'll review my old posts and replies, because I think I had this same problem, or a very similar one, months ago.

Jim
Apr 3 '08 #3
bhughes2187
32 New Member
The machine login uses a name and password that exists on the file server. The share is mapped, I can even have the share open watching for the file to arrive and I still get the error.
Apr 3 '08 #4
NeoPa
32,577 Recognized Expert Moderator MVP
Please remember to provide a meaningful Title for any threads started (Please Use Appropriate Titles for New Threads!). This helps to ensure that other members, and also the general public, will have a better chance of finding answers to any similar questions.

ADMIN.
Apr 3 '08 #5
bhughes2187
32 New Member
Resolved the issue by setting the save path in PDFcreator to the network share. No longer copying from one location to the other.
Apr 7 '08 #6
ADezii
8,834 Recognized Expert Expert
In my app I am creating, there is a procedure that does a file copy from the local drive to a network share. The issue I am having, is even though I have the share mapped, and I can browse to the share with no problems, when ever the procedure is run, I get a Permission Denied error.

When I get this error, I click on Debug and find the line causing the error which is my file copy line. If I click continue, the code sequence finishes and the file is copied out to the network share. I have no clue what is causing this issue or how to fix it. Is there a possible way of suppressing the error and having it just continue on with the next line?

The code procedure is as follows"
Expand|Select|Wrap|Line Numbers
  1. 'Set data paths. Where file is located and location to copy data
  2.     DestName1 = "X:\PDF\"
  3.     DirName1 = "C:\portfolio\TEMPDATA\"
  4.     nextbookA = Dir(DirName1 & "*.pdf")
  5.    If nextbookA <> "" Then
  6.    FileCopy DirName1 & nextbookA, DestName1 & nextbookA
  7.    Kill DirName1 & nextbookA
  8.    End If
  9.  
This line:
FileCopy DirName1 & nextbookA, DestName1 & nextbookA

is the line it crashes on
  1. Are you aware that your code will only copy the 1sf File with a *.pdf extension in C:\portfolio\TE MPDATA\?
  2. If you attempt to copy a File that is currently Open, you will receive an Error, and the FileCopy operation will fail. Couold this be the case?
Apr 7 '08 #7
bhughes2187
32 New Member
No that wasn't the case. The full PDF file was created and sitting in c:\portfolio\te mpdata. Where the error "Permission Denied" was happening was on copying the completed file to X:\PDF
Apr 8 '08 #8

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

Similar topics

1
2296
by: Beryl Small | last post by:
I have a web application in Visual Studio.Net 2003. On the click event of a button on my .aspx page, I use the following FileCopy SourceFile, DestinationFil the Sourcefile is on a mapped drive (s:\) on the server it returns the error "File not found" even though the file is there. The same code in the same place works fine if the file is on the c:\ drive. Same code also works fine with the mapped server drive in .NET if a put it in a...
6
5875
by: deko | last post by:
In a multi-user environment, I have a table that stores hyperlinks to documents that are stored on the machine that hosts the mdb database. The table entry looks like this: ProductDescription.htm#file:\\DBHOST\C$\Documents and Settings\Administrator\My Documents\Products\Documents\ProductDescription.htm Having the hyperlink in this format allows the document to be opened by anyone on the local area network.
9
5888
by: cantelow | last post by:
Hi. I've got a program printing multiple pdf reports, and I need to wait for completion of various associated operations- The pdf printer prints to one file, then I need to copy that where I need it, then delete the old file, repeat with the next report. I need to wait for each step to complete or I get errors due to the previous thing being open and not done yet. Is there any elegant way to do that? My FileCopy in particular has...
3
2314
by: Lou | last post by:
I have a file name witha wildcard: "D:\myFolder\Logo1.*tga" There are 50 files that match this wilcard. I want to copy these 50 files to another directory I Tried FileCopy("D:\myFolder\Logo1.*tga","D:\TargetDir") but that didnt work?
0
1304
by: daniele.balducci | last post by:
Hi All, I'm experiencing troubles in a simple .net web application. The applicatione is made up by a single form looping to move some files to a different folder . the main loop is as follows : C Const CurrUploadDir= ..... Const CurrSentDir= ..... Dim CurFile as string CurFile = Dir(CurrUploadDir & "*.*")
0
963
by: reidarT | last post by:
I have a project with an installfile-folder with files. I want to copy files from this folder to another location like Sorce = "InstallFiles\file.txt" Destination="c:\...\file.txt" FileCopy (Source,Destination) I seems like I need the whole source path to make this work. When I publish this application I don't know where it is located, so to add the complete path is difficult.
3
2445
by: betygs | last post by:
Hi all, I´m not speak english so well, but i'll try to do it better. I have a problem with the filecopy function when i use the IP instead of a computer name. For example This sentence works ok FileCopy "\\gdl1mfg994\qualcomm\k2.pdf", "\\gdl1me090\dibujos\bety.pdf" But this doesn't work FileCopy "\\168.192.1.16\qualcomm\k2.pdf", "\\168.190.4.14\dibujos\bety.pdf" It display this error: "path not found"
4
2294
by: =?Utf-8?B?UnVpIE9saXZlaXJh?= | last post by:
Where can I find XP version of FILECOPY.AVI, to use in a dialog? There is a movie called FILECOPY.AVI which is included with Visual Studio 2005, but it is the 16 bit (Windows 95) version. There are a few other videos in the same directory that look like the 32 bit versions. My question is: Where can I find a 32 bit (XP style) version of this video? I know it exists because if I copy files in XP, I get a different animation, with...
7
15856
by: TracyWants2Know | last post by:
Access Version: 2002 SP3 OS: MS Windows XP Professional Code from Module: Dim txtFileNameBuES As String Dim txtFileNameBuESXP As String Dim txtPathNameBuTo As String txtFileNameBuES = DLookup("", "Variables") txtFileNameBuESXP = DLookup("", "Variables")
0
9636
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10306
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
10138
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...
1
10074
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8961
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...
1
7485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5373
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
5503
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.