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

FileCopy results in runtime error 53 file not found

Bob
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"

FileCopy strSourceFile, strDestinationFile

End Sub

Test.txt exists and is located in the c: directory. I've also tried
different variations of the code with other directory and file
combinations with the same result.

My code seems consistent with help file example syntax.

Can anyone suggest what is causing this or know a work around?

Thanks in Advance!

Bob

Feb 1 '07 #1
5 17585
Bob wrote:
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"

FileCopy strSourceFile, strDestinationFile

End Sub

Test.txt exists and is located in the c: directory. I've also tried
different variations of the code with other directory and file
combinations with the same result.

My code seems consistent with help file example syntax.

Can anyone suggest what is causing this or know a work around?

Thanks in Advance!

Bob
In your immediate (debug) window enter
strSourceFile = "C:\Test.txt"
? dir(strSourceFile)

Does it return the file name or does it return a blank line? If blank,
the file can't be found.
Feb 1 '07 #2
Bob
On Feb 1, 2:01 pm, salad <o...@vinegar.comwrote:
Bob wrote:
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"
FileCopy strSourceFile, strDestinationFile
End Sub
Test.txt exists and is located in the c: directory. I've also tried
different variations of the code with other directory and file
combinations with the same result.
My code seems consistent with help file example syntax.
Can anyone suggest what is causing this or know a work around?
Thanks in Advance!
Bob

In your immediate (debug) window enter
strSourceFile = "C:\Test.txt"
? dir(strSourceFile)

Does it return the file name or does it return a blank line? If blank,
the file can't be found.- Hide quoted text -

- Show quoted text -
Thanks for getting back to me!

I did as you suggested and got a runtime error 13 - Type mismatch.

I declared strSourceFile as a String, should it be something else?

Bob

Feb 1 '07 #3
Bob wrote:
On Feb 1, 2:01 pm, salad <o...@vinegar.comwrote:
>>Bob wrote:
>>>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"
>> FileCopy strSourceFile, strDestinationFile
>>>End Sub
>>>Test.txt exists and is located in the c: directory. I've also tried
different variations of the code with other directory and file
combinations with the same result.
>>>My code seems consistent with help file example syntax.
>>>Can anyone suggest what is causing this or know a work around?
>>>Thanks in Advance!
>>>Bob

In your immediate (debug) window enter
strSourceFile = "C:\Test.txt"
? dir(strSourceFile)

Does it return the file name or does it return a blank line? If blank,
the file can't be found.- Hide quoted text -

- Show quoted text -


Thanks for getting back to me!

I did as you suggested and got a runtime error 13 - Type mismatch.

I declared strSourceFile as a String, should it be something else?

Bob
I'm not sure. In the Debug window you don't declare variables. You
have to enter each line followed by the enter key to run the line.

Your code looks fine. DOn't know why it's failing.
Feb 1 '07 #4
Bob wrote:
On Feb 1, 2:01 pm, salad <o...@vinegar.comwrote:
>>Bob wrote:
>>>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"
>> FileCopy strSourceFile, strDestinationFile
>>>End Sub
>>>Test.txt exists and is located in the c: directory. I've also tried
different variations of the code with other directory and file
combinations with the same result.
>>>My code seems consistent with help file example syntax.
>>>Can anyone suggest what is causing this or know a work around?
>>>Thanks in Advance!
>>>Bob

In your immediate (debug) window enter
strSourceFile = "C:\Test.txt"
? dir(strSourceFile)

Does it return the file name or does it return a blank line? If blank,
the file can't be found.- Hide quoted text -

- Show quoted text -


Thanks for getting back to me!

I did as you suggested and got a runtime error 13 - Type mismatch.

I declared strSourceFile as a String, should it be something else?
Try this in the Immediate window:

? Dir("c:\Test.txt")

If the file exist then it should return "Test.txt"

--
'---------------
'John Mishefske
'---------------
Feb 1 '07 #5
Bob
On Feb 1, 3:08 pm, John Mishefske <jmishefsk...@SPAMyahoo.comwrote:
Bob wrote:
On Feb 1, 2:01 pm, salad <o...@vinegar.comwrote:
>Bob wrote:
>>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"
> FileCopy strSourceFile, strDestinationFile
>>End Sub
>>Test.txt exists and is located in the c: directory. I've also tried
different variations of the code with other directory and file
combinations with the same result.
>>My code seems consistent with help file example syntax.
>>Can anyone suggest what is causing this or know a work around?
>>Thanks in Advance!
>>Bob
>In your immediate (debug) window enter
strSourceFile = "C:\Test.txt"
? dir(strSourceFile)
>Does it return the file name or does it return a blank line? If blank,
the file can't be found.- Hide quoted text -
>- Show quoted text -
Thanks for getting back to me!
I did as you suggested and got a runtime error 13 - Type mismatch.
I declared strSourceFile as a String, should it be something else?

Try this in the Immediate window:

? Dir("c:\Test.txt")

If the file exist then it should return "Test.txt"

--
'---------------
'John Mishefske
'---------------- Hide quoted text -

- Show quoted text -
This is really strange...
I went into the c:\Folder
Tools
Folder options
View
and unchecked hide extensions for known file types
Now the code operates as it should.

Feb 1 '07 #6

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

Similar topics

1
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...
2
by: deko | last post by:
I want to turn error handling off, then back on in a sub routine that backs up a select set of documents. For some reason, I can't seem to get this to work - Private Sub BackupDocs() On Error...
6
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: ...
9
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...
0
by: Perdo | last post by:
I still haven't seen any solution to or alternate for copying files to/from server drive using web form button server control The FileCopy() doesn't seem to work for me. There is Login error or...
3
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...
0
by: .nLL | last post by:
Erorr is --------------------- Microsoft VBScript runtime error '800a0046' Permission denied /a.asp, line 3 -----------------------
7
by: bhughes2187 | last post by:
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...
7
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 ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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
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,...
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...

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.