Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with spaces in path to database

Status
Not open for further replies.

mok44

MIS
Sep 3, 2002
36
US
I am able to open other Access databases from the current one as long as the path does not contain any spaces, as in

stAppName = "C:\Program Files\Microsoft Office\Office10\msaccess.exe C:\FolderName\DatabaseName.mdb"
Call Shell(stAppName, 1)

But the call does not work if the path to the file contains any spaces, like:

"c:\Folder Name\DatabaseName.mdb"
I get error: "File not found, c:\folder.mdb"

I don't always have control over the folder names.
Has anyone find a way around this problem? Are there any other ways to launch Databases/Forms?
Thanks
 
Try including double quotes within the stAppName string to enclose the database name. To write this you have to use two double-quotes together like:

stAppName = "program.exe ""C:\folder\database name.mdb"""

Step through and look at the value of stAppName to see that the double-quotes are around the database name. Note that there are 3 double-quotes at the end.
 
Have you tried the 8 character path? Dont know what its called, but handles long filenames in DOS.

my db is "My Database.mdb" with a back end so i had to call it... "mydata~1.mdb" (My Database_BE.mdb) and "mydata~2.mdb" (My Database.mdb)

rule i follow, count 6 letters, no spaces, then "~1" if theres only one filename like it in the path, or "~2" if i want the second file with like filenames. Sorry if im not making sense, its late!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top