469,361 Members | 2,332 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,361 developers. It's quick & easy.

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 16827
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Beryl Small | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.