473,790 Members | 2,528 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FileCopy command - Runtime error 52 Bad File Name or Number

4 New Member
Access Version: 2002 SP3
OS: MS Windows XP Professional

Code from Module:
Dim txtFileNameBuES As String
Dim txtFileNameBuES XP As String
Dim txtPathNameBuTo As String

txtFileNameBuES = DLookup("[ESPCLoc]", "Variables" )
txtFileNameBuES XP = DLookup("[DBLoc]", "Variables" )
txtPathNameBuTo = DLookup("[BackupLoc]", "Variables" )

cpyst1 = Chr$(34) & txtFileNameBuES & Chr$(34)
cpyst2 = Chr$(34) & txtFileNameBuES XP & Chr$(34)
cpyst3 = Chr$(34) & txtPathNameBuTo & "\ExpressScore. mdb" & Chr$(34)
cpyst4 = Chr$(34) & txtPathNameBuTo & "\ExpressScoreX P.mdb" & Chr$(34)

FileCopy cpyst1, cpyst3
FileCopy cpyst2, cpyst4
---
Contents of fields in table:
txtFileNameBuES =C:\Program Files\WorkKeys\ Working\Express Score.mdb
txtFileNameBuES XP=C:\Program Files\WorkKeys\ Working\Express Score.mdb
txtPathNameBuTo =C:\WorkKeys\Ba ckup

I am trying to make a copy of two files ES and ESXP into the backup folder. Different sites using this have different locations for their files, so I'd prefer not to hardcode the path.

I get the error message listed in the Title. Not sure how to use the Immediate indow in Debug to check, or what else to do. I have been searching all day with no luck. Thanks.
Jul 21 '08 #1
7 15856
ADezii
8,834 Recognized Expert Expert
Hello Tracy, try:
Expand|Select|Wrap|Line Numbers
  1. Dim txtFileNameBuES As String
  2. Dim txtFileNameBuESXP As String
  3. Dim txtPathNameBuTo As String
  4.  
  5. txtFileNameBuES = DLookup("[ESPCLoc]", "Variables")
  6. txtFileNameBuESXP = DLookup("[DBLoc]", "Variables")
  7. txtPathNameBuTo = DLookup("[BackupLoc]", "Variables")
  8.  
  9. FileCopy txtFileNameBuES, txtPathNameBuTo & "\ExpressScore.mdb"
  10. FileCopy txtFileNameBuESXP, txtPathNameBuTo & "\ExpressScoreXP.mdb"
Jul 21 '08 #2
TracyWants2Know
4 New Member
YEESSSSS!!! Thank you very much, that worked perfectly!!!
Jul 23 '08 #3
ADezii
8,834 Recognized Expert Expert
YEESSSSS!!! Thank you very much, that worked perfectly!!!
You are quite welcome. I guess you can now change you name from TracyWants2Know to TracyNowKnows! (LOL).
Jul 23 '08 #4
TracyWants2Know
4 New Member
What if I wanted to copy multiple files into one?

FileCopy C:\WorkKeys\Roc k.txt+Chester.t xt, C:\WorkKeys\All Files.txt
Jul 31 '08 #5
ADezii
8,834 Recognized Expert Expert
What if I wanted to copy multiple files into one?

FileCopy C:\WorkKeys\Roc k.txt+Chester.t xt, C:\WorkKeys\All Files.txt
I'm almost positive that you cannot do that with FileCopy, but all is not lost if the know the File Names and their locations ahead of time. You can create a Batch File that easily performs the multiple File copies, then execute it. The following code will copy the Files One.txt and Two.txt in the C:\Test Directory to the C:\Windows Directory. They will be concatenated and combined into a single File named Big.txt. The Copy process will be verified (/V) and there will no no Overwrite Warning (/Y) should the Destination File exist. Make sure to give the File a *.bat extension and if you need further help, let me know:
Expand|Select|Wrap|Line Numbers
  1. 'Contents of CopyMany.bat
  2. @Echo Off
  3. cls
  4. Cd\Test
  5. Copy /V /Y 1.txt + 2.txt C:\Windows\Big.txt
Aug 1 '08 #6
TracyWants2Know
4 New Member
Can I do this as a Call Shell(Copy ...) or something other than a batch file? I'd like to have all of the code within my access database and not have to distribute a separate batch file too.
Aug 4 '08 #7
ADezii
8,834 Recognized Expert Expert
Can I do this as a Call Shell(Copy ...) or something other than a batch file? I'd like to have all of the code within my access database and not have to distribute a separate batch file too.
Can I do this as a Call Shell(Copy ...) or something other than a batch file? I'd like to have all of the code within my access database and not have to distribute a separate batch file too?
I don't think that this can be accomplished internally within Access, but then again, I nevr had a reason to attempt it.
Aug 4 '08 #8

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

Similar topics

1
6614
by: Victoria Chin | last post by:
Could someone point me in the right direction? I've migrated three FrontPage 2002 websites to a new web server. Each web site has a Access 2000 database on the data server. I have the global.asa on each site pointing to a .udl file which is pointing to the appropriate access DB on the data server. We're not allowed to use DSN's. Front Page 2002 will not allow me to create a network connection to an Access (only SQL). Only one of the three...
8
5160
by: swathky | last post by:
I've tried mutiple things but no go -- (sorry this is so long) I'm collecting a 5 digit number in an input box function and all works fine until a number is passed that doesn't exist in the database. I can't figure out where/how to check that the number exists before I get the error code 2105. Here's my function to get the number that I run when a command button is clicked to open the frmEditLoans form: Public Function...
2
1991
by: Aleksandar | last post by:
Hi, I need to convert set of Java classes exported from IBM Modeling environment to C# for implementation. When I invoke JCLA conversion from File->Open->Convert in Visual Studio 2005 it starts just fine parsing file after file but then it breaks on page 7 of JCLA Wizard. The dialog with runtime error is shown that says:
0
1132
by: kalyanijala | last post by:
Hi There, I have a problem running a VB program. This programs actually reads a DAT file and gives the best CPU time taken to run the program. for example I'm reading files like TN3004, TN3104 , TN3204 ...so forth but when i try to run this prog it gives an error File name currently limnited to 8.3 format ..**please try again** <-<-3;1H Enter name of Read this is the part of the code where i'm having issues Private Sub cmdRun_Click()
8
13104
by: g_man | last post by:
I am trying trap Runtime error 3022 (duplicates) in the click event of a command button that closes the form. I have code in the Form_Error event that does a good job of providing a more meaningful error message than the default. It works in every situation except when the user clicks the close button. I am using Me.Dirty=False to force a save but if there are duplicates I just get the standard Runtime 3022 error message. I am wondering...
5
17644
by: Bob | last post by:
I'm not sure why this is happening. Using Access 2003. My code is as follows... Private Sub Command1_Click() Dim strSourceFile As String Dim strDestinationFile As String strSourceFile = "C:\Test.txt" strDestinationFile = "C:\TextFile\test2.txt"
4
9435
by: rohitdoke | last post by:
Hello, we are using IIS 6.0 and facing an error as Microsoft VBScript runtime error '800a01c2' Wrong number of arguments or invalid property assignment: 'verifychecksum' /OnlineBooking/receivepg.asp, line 29
1
3810
by: morrisqueto | last post by:
Hello, One of my websites just started sending a new rare error. The site has been working for almost 2 years without trouble, but today morning started giving away this error in all my views. Microsoft VBScript runtime error '800a01fb' An exception occurred: 'MoveNext' /test.asp, line 544 Here is the code:
3
8652
by: suganya | last post by:
Hi Some professionals already has developed the project using menu. In my company, they have given me task to clear the error in that. It is a script file named as "menubarAPI4.js" which is kept inside the folder "menu_script". The following is the code in this file. var menuOffsetTop=menuOffsetLeft=submenuOffsetTop=submenuOffsetLeft=submenuOffsetRight=0; var Doc=this.document;var standards=Doc.createElement&&Doc.createTextNode?1:0;...
0
9666
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...
1
10145
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
9986
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...
1
7530
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
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4094
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
3707
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
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.