Error 3304 - Invalid Path

fuzzygeek

Energy Ebbing
Local time
Today, 07:21
Joined
Mar 28, 2003
Messages
989
In VBA, when using DoCmd.TransferText, the filename is similar to "C:\My Documents\Your Docs\data box.txt". I received the error 3304, invalid path. Even if I use "C:\'My Documents'\'Your Documents'\'databox.txt'" I get the error. I know it is due to the space, but using underscores is not an option. Has someone overcome this problem with the transfertext method?
 
Do this:

sPath="""C:\My Documents\Your Docs\data box.txt"""

Then use sPath in the TransferText inplace of the string.
 
Thanks! I tried it before but when I use it, I get Error 31519 - You Cannot Import This File.

The following don't work:
strFileName = "C:\'My Documents'\aaadata.txt"
strFileName = "C:\My Documents\aaadata.txt"
strFileName = """C:\My Documents\aaadata.txt"""
strFileName = """""C:\My Documents\aaadata.txt"""""
strFileName = "'C:\My Documents\aaadata.txt'"

The following does work
strFileName = "C:\My_Documents\aaadata.txt"
 
Try:

sPath="'"C:\My Documents\Your Docs\data box.txt"'"

This will surround it with a single quote
 
Found it

Thanks, but that got the same error - Invalid path. I kept experimenting and finally got a solution. The following worked.

strFileName = "" & "C:\My Documents\aaadata.txt" & ""

Thanks for your help Travis.
 
Follow up

Travis was absolutely correct both times. The real problem was operator error. "My Documents" on Win 98 is at root level unless you create a profile. On Win 2000 and Win XP, it is at "C:\documents and settings\<user profile>\My Documents..." I was thinking in 98 and working in XP. My apologies to Travis, his solutions were correct.
 

Users who are viewing this thread

Back
Top Bottom