By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,997 Members | 1,470 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,997 IT Pros & Developers. It's quick & easy.

A funny problem to have

P: n/a
Generally, it is the case that space characters in the names of things
can cause difficulties, and removing the spaces can make things work
more smoothly, but I recently found a reverse case.

I had a full path to an MDB file woth no space characters, and I
couldn't open it by dragging it to a shortcut to msaccess.exe. It turns
out the problem was that the path had "-" charactrers, and Windows
didn't put quotes around the path for me because there were no spaces.
Access, however, interpreted the dashes as as option qualifiers and
failed to parse the path.

I solved the problem by renaming my MDB to -have- a space in the name.

Why, you may ask, would I drag the MDB rather than double-clicking it in
the first place? Because I have multiple versions of Access on my
system, and need to be explicit about which one I'm using to open a file.
Jan 5 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Bri

Steve Jorgensen wrote:
Generally, it is the case that space characters in the names of things
can cause difficulties, and removing the spaces can make things work
more smoothly, but I recently found a reverse case.

I had a full path to an MDB file woth no space characters, and I
couldn't open it by dragging it to a shortcut to msaccess.exe. It turns
out the problem was that the path had "-" charactrers, and Windows
didn't put quotes around the path for me because there were no spaces.
Access, however, interpreted the dashes as as option qualifiers and
failed to parse the path.

I solved the problem by renaming my MDB to -have- a space in the name.

Why, you may ask, would I drag the MDB rather than double-clicking it in
the first place? Because I have multiple versions of Access on my
system, and need to be explicit about which one I'm using to open a file.


You could modify your shortcuts to include the path to the Access
version you want to open it with. I almost always do this as most of my
apps have security and therefor an associated Workgroup file, so I have
to do the full target shortcut anyway.

Examples targets for two different versions of Access on the same PC and
hyphens in the name (all one one line):

"C:\Program Files\Microsoft Office 97\Office\msaccess.exe"
"E:\mypath\myApp-97-FE.mdb" /wrkgrp E:\mypath\myAppFE.mdb

"C:\Program Files\Microsoft Office 2K\Office\msaccess.exe"
"E:\mypath\myApp-FE-2K.mdb" /wrkgrp E:\mypath\myAppFE.mdb

--
Bri

Jan 5 '06 #2

P: n/a
Bri wrote:

Steve Jorgensen wrote:
Generally, it is the case that space characters in the names of things
can cause difficulties, and removing the spaces can make things work
more smoothly, but I recently found a reverse case.

I had a full path to an MDB file woth no space characters, and I
couldn't open it by dragging it to a shortcut to msaccess.exe. It
turns out the problem was that the path had "-" charactrers, and
Windows didn't put quotes around the path for me because there were no
spaces. Access, however, interpreted the dashes as as option
qualifiers and failed to parse the path.

I solved the problem by renaming my MDB to -have- a space in the name.

Why, you may ask, would I drag the MDB rather than double-clicking it
in the first place? Because I have multiple versions of Access on my
system, and need to be explicit about which one I'm using to open a file.

You could modify your shortcuts to include the path to the Access
version you want to open it with. I almost always do this as most of my
apps have security and therefor an associated Workgroup file, so I have
to do the full target shortcut anyway.

Examples targets for two different versions of Access on the same PC and
hyphens in the name (all one one line):

"C:\Program Files\Microsoft Office 97\Office\msaccess.exe"
"E:\mypath\myApp-97-FE.mdb" /wrkgrp E:\mypath\myAppFE.mdb

"C:\Program Files\Microsoft Office 2K\Office\msaccess.exe"
"E:\mypath\myApp-FE-2K.mdb" /wrkgrp E:\mypath\myAppFE.mdb


When I use workgroups, I do something similar, but I use batch files
instead of shortcuts because I store each code version in a different
folder, and I dont' want to have to change the shortcut each time I make
a new copy (and remember to do that, so I open the right version!)

@Echo off

: Get just drive & file path (no extension) from full path of this
: batch file. Use dummy "for" loop to allow for loop variable
: semantics to be used to extract path components. Ampersand
: character separates 2 statements in parentheses.
for %%x in (%0) do (set mydirpath=%%~dpx& set fullpathnoext=%%~dpnx)

: Start Access, and open the database file from the same directory
: path this batch file was executed from. Also use the security
: workgroup file in this directory.
start "" "C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE"
"%fullpathnoext%.mdb" /wrkgrp "%mydirpath%InvSys.MDW"
Jan 5 '06 #3

P: n/a
Bri

Steve Jorgensen wrote:
When I use workgroups, I do something similar, but I use batch files
instead of shortcuts because I store each code version in a different
folder, and I dont' want to have to change the shortcut each time I make
a new copy (and remember to do that, so I open the right version!)

@Echo off

: Get just drive & file path (no extension) from full path of this
: batch file. Use dummy "for" loop to allow for loop variable
: semantics to be used to extract path components. Ampersand
: character separates 2 statements in parentheses.
for %%x in (%0) do (set mydirpath=%%~dpx& set fullpathnoext=%%~dpnx)

: Start Access, and open the database file from the same directory
: path this batch file was executed from. Also use the security
: workgroup file in this directory.
start "" "C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE"
"%fullpathnoext%.mdb" /wrkgrp "%mydirpath%InvSys.MDW"


I see that you have the quotes around the MDB name so you should be able
to use either the name with a hyphen or a space, shouldn't you? Are you
not using a similar technique when you don't have a workgroup?

--
Bri

Jan 6 '06 #4

P: n/a
Bri wrote:

Steve Jorgensen wrote:
When I use workgroups, I do something similar, but I use batch files
instead of shortcuts because I store each code version in a different
folder, and I dont' want to have to change the shortcut each time I
make a new copy (and remember to do that, so I open the right version!)

@Echo off

: Get just drive & file path (no extension) from full path of this
: batch file. Use dummy "for" loop to allow for loop variable
: semantics to be used to extract path components. Ampersand
: character separates 2 statements in parentheses.
for %%x in (%0) do (set mydirpath=%%~dpx& set fullpathnoext=%%~dpnx)

: Start Access, and open the database file from the same directory
: path this batch file was executed from. Also use the security
: workgroup file in this directory.
start "" "C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE"
"%fullpathnoext%.mdb" /wrkgrp "%mydirpath%InvSys.MDW"

I see that you have the quotes around the MDB name so you should be able
to use either the name with a hyphen or a space, shouldn't you? Are you
not using a similar technique when you don't have a workgroup?

--
Bri


Yes, if I use either the batch file or the shortcut, I wouldn't have the
problem I described.
Jan 6 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.