472,784 Members | 973 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,784 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 17462
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: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.