View Full Version : Accounting for SPACE in location


TimE
11-12-2007, 06:16 AM
When the startup form is opened, I have code that checks to see if a file exists. If it does not, then it will be copied to the local computer. Problem is, the path contains a space. How do I account for this? When I change source to one without a space, it works fine. I do not have control of the path name, so having it changed is not an option

SAMPLE CODE:

sDestination = "C:\TESTDB\"
sSource = "\\testdb\misc\prod test\Restore"

FileCopy sSource & sFile1, sDestination & sFile1

YevS
11-12-2007, 06:36 AM
not sure about "filecopy" but you could try putting it in single quotes:

FileCopy "'" & sSource & sFile1 & "'", "'" & sDestination & sFile1 & "'"

boblarson
11-12-2007, 06:48 AM
The source and destination should not matter about having spaces in them. What does matter is making sure both have the backslashes in the path. I noticed that your destination has the backslash but the source string does not.