Re: Path/File Access Error
Have you defined sFileName someplace?
Re: Path/File Access Error
Yes as a string in general declarations
Re: Path/File Access Error
Thats probably because a FileListBox only shows FileNames, you need to use a DirListBox as well to find its path.
Re: Path/File Access Error
File1.Path will give you the path that the file list box is showing
Re: Path/File Access Error
Quote:
Originally Posted by paralinx
Yes as a string in general declarations
Ok, that's good but you might want to start the names of form-level variables with "m" the name might better be msFileName.
Re: Path/File Access Error
Quote:
Originally Posted by MartinLiss
Ok, that's good but you might want to start the names of form-level variables with "m" the name might better be msFileName.
Oh ok sorry, what does the M stand for though?
Re: Path/File Access Error
Quote:
Originally Posted by paralinx
File1.Path will give you the path that the file list box is showing
Yes File1.Path will show the App.Path but if you want to copy these files to another location how are you finding this new path?
FileCopy sFileName, lstSetupDire.Text 'Error Line
What is in lstSetupDire? The filename and path?
Re: Path/File Access Error
Quote:
Originally Posted by Keithuk
Yes File1.Path will show the App.Path but if you want to copy these files to another location how are you finding this new path?
FileCopy sFileName, lstSetupDire.Text 'Error Line
What is in lstSetupDire? The filename and path?
that's the listbox that shows the directory of the file I want to copy it to.
Re: Path/File Access Error
You must also include the filename in the destination location. It's not like DOS, which uses the original name in a copy statement. Don't forget the "\"
2 Attachment(s)
Re: Path/File Access Error
I stepped through my program and looked at the variables and they equal the correct directory and file names
Re: Path/File Access Error
Use a debug.print statement for each file, you can't really see the full path in the tool tip. It may be missing the "\" or have an extra one on the end.
Re: Path/File Access Error
No, they are perfectly fine here's what comes up in the debug window
Code:
C:\Documents and Settings\Owner\Desktop\My Stuff\Music\Led Zeppelin\Achilles last stand.mp4
C:\Documents and Settings\Owner\Desktop\My Stuff\Music\Led Zeppelin
Re: Path/File Access Error
You are not specifying the destination filename
Try this:
VB Code:
FileCopy sFileName, lstSetupDire.Text & sFileName
Re: Path/File Access Error
Oh yeah! I've gotta include what the new copied file name will be.
Thanks a lot jcis
Re: Path/File Access Error
Quote:
Originally Posted by dglienna
You must also include the filename in the destination location. It's not like DOS, which uses the original name in a copy statement. Don't forget the "\"
Did you miss that?
Re: Path/File Access Error
Oh sorry, I didn't even see that post :blush:
Re: Path/File Access Error
Quote:
Originally Posted by paralinx
Oh ok sorry, what does the M stand for though?
Nothing to be sorry about, but part of the normal convention for naming files includes m or m_ for module-level (meaning form-module-level) variables and g or g_ for global (meaning those defined at the top of code modules). That way you 6 months from now or someone maintaing your program will know the scope of the variable by just looking at the name.