Shortcut

G

Guest

I have a secured .mdb on a network server with a shortcut setup on the server
as follows in the target:

"path to MSACCESS.EXE" "path to database file" /WRKGRP "path to workgroup
file"

I'm at the limit of the characters in the Target editbox, and need to
replace the drive letter reference with '\\servername\spacepath\' for the
database file and workgroup file.

My questions are:

1. Short of shortening my paths and file names, how can I make it fit?
Can I set and use variables?
2. Is there a way to bring the application path in for all local machine
installations? (Depending on desktop support's choice of installation path,
and for different versions of Access.)

Thanks,
VBA Dabbler
 
P

Paul Overway

Ideally, you should try to shorten your UNC paths. Performance will suffer
with long UNC paths anyway. Try to get your app at the root of the share.
With shorter paths, I suspect you wouldn't have the issue with the target
edit box.
 
G

Guest

I don't know why not. I'll have to search for a Windows API call(s) to
retrieve the InstallPath for Access.

Any suggestions?

Regards,
VBA Dabbler
 
G

Guest

Good suggestion. Although, I do have limitations on a corporate network, I
can make adjustments in the directory structure (below a base directory) and
also with the database and workgroup file names.

More than anything else, I'm most challenged with the plethora of potential
paths to the 'MSACCESS.EXE' file. Any suggestions for a Windows API call
would be most appreciated.

Regards,
VBA Dabbler
 
P

Paul Overway

No API calls required, just instantiate the Access application object you
require and use SysCmd(9) to determine the install dir. Alternatively,
there is some sample VB Script with a white paper on installing Access apps
at site below under Extras...the script can be used to obtain the path from
the registry.
 
G

Guest

Paul,
When referring to instantiating, are you suggesting to call the SysCmd(9)
from within VBA? If so, what application?

Regards,
VBA Dabbler
 
P

Paul Overway

Instantiate meaning to create an object, i.e., using CreateObject or New.
Example,

Set x = CreateObject("Access.Application.9")

MsgBox "Install path is " & x.SysCmd(9)

You could do this in any VBA enabled app, VB Script or VB.
 
G

Guest

Thanks, I understand - I did this last evening. However, I'm trying to
launch a secured Access database and am having trouble with portability of
the 'Shortcut', not only in length but in referencing the MSACCESS.EXE
application.

Assuming no Office application is running, is there a way to retrieve the
Access InstallPath and basically build the 'Shortcut' commandline within a
..bat file?

Regards,
VBA Dabbler
 
P

Paul Overway

What you are describing is a need for your installer....the installer for
your app needs to determine where Access is located. I've pointed you to
some example code that describes exactly how to find this out. Your
reference to an Office application running is puzzling. Likewise the
suggestion that a bat file might build the shortcut. You need to build an
installer package for your app...part of that package will need to provide
some means to determine where Access is installed, some means = VB Script,
VB, a built in function, etc.
 
G

Guest

I've visited the installer site you pointed me to - thanks for the
information. I'll explore it more.
 
T

TC

There are some API calls that return the executable name & path
corresponding to a specified file extension (eg. mdb), but
unfortunately I don't have access to my information on them, at this
PC.

Would it be ok to hard-code the path? It's not something that is likely
to change, IMO.
 
G

Guest

Based on your first suggestion of using a local .bat file to launch the
database, I have created one and am successfully launching it. I have some
issues with it though from a portability and maintenance standpoint:
1. The database is on a corporate server, and potentially hundreds of
employees will access it from their respective local machines.
2. Those machines have Office 2000, XP, and 2003 on them, and are
running on the Windows 2000 and XP Professional operating systems (our IT
standard).
3. Some desktop technicians install Office upgrades in directories which
don't correspond to the Microsoft default.
4. We will have employee turnover and equipment will change.

Based on these issues I think that a batch file with command line
instructions to retrieve the MSACCESS.EXE InstallPath from the Windows
Registry would work. However, in browsing the MS KB, I've not turned up
anything yet. I've looked at 'regedit.exe', etc. to see if it could be
called upon to deliver the InstallPath. - don't have a solution yet.

Following is my .bat file contents:

REM Need to locate a method for retrieving the MSACCESS.EXE InstallPath
from the system
REM registry, and assign that value to 'AccessPath'.

Set AccessPath=C:\Program Files\Microsoft Office\OFFICE11\
Set DBFile=\\servername\DB_Path\filename.mdb
Set WrkgrpFile=\\servername\WG_Path\WrkgrpFileName.mdw

"%AccessPath%\MSACCESS.EXE" "%DBFile%" /WRKGRP "%WrkgrpFile%"

Also, when launching the database with the .bat file, the Cmd Window remains
open until the Access appliation window is closed or the Cmd Window is
manually closed. Do you know of a command line instruction to close the
window?

Any suggestions would be most appreciated.

Regards,
VBA Dabbler
 
T

TC

VBA said:
Based on your first suggestion of using a local .bat file to launch the
database, I have created one and am successfully launching it. I have some
issues with it though from a portability and maintenance standpoint:
1. The database is on a corporate server, and potentially hundreds of
employees will access it from their respective local machines.
2. Those machines have Office 2000, XP, and 2003 on them, and are
running on the Windows 2000 and XP Professional operating systems (our IT
standard).
3. Some desktop technicians install Office upgrades in directories which
don't correspond to the Microsoft default.
4. We will have employee turnover and equipment will change.

Given all that, it seems clear that hard-coding the path is not an
option.

Paul's suggestion of writing a proper Install program, is probably the
way to go.

There *is* a win32 API to return the full path & name of the executable
for a given file extension, but I can't for the life of me remember its
name, & I'm at a public PC, so I don't have any of my resources to
check :-( But I'm not sure you can reference a win32 API from directly
within a batch file.

If you're writing the "batch file" in a scripting language such as
VBScript, the script could examine the registry to get what you want.
This PC does not have Access, so using JPEG files as an alternative
example:

- the so-called default value of key HKEY_CLASSES_ROOT/.jpeg is
"jpegfile"

- the default value of key
HKEY_CLASSES_ROOT/jpegfile/shell/open/command is:
"C:\PROGRA~1\INTERN~1\iexplore.exe" -nohome

The second default value shown above, is the command line to execute
when the user double-clicks a JPEG file. Precisely the same technique
will give you the command line that windows executes when the user
double-clicks an MDB file.

Sorry, but gotta go *right now*! Hope that helps,
TC
 
G

Guest

I suspected that I will have to go the installer route, but thought I'd try
the simplest approach, in concept.

I apologize, I'm not following you with regard to the "batch file" - I just
searched MSDN for 'VBScript' and found a new area to explore. This question
will definitely display my ignorance about 'VBScript': What environment is
the code written in and what would launch it? Premise: no applications are
running previous to opening the secured Access database.

I don't follow you regarding your 'jpeg' example.

Regards,
VBA Dabbler
 
T

TC

VBA Dabbler wrote:
(snip)
I don't follow you regarding your 'jpeg' example.

Yes, I did not explain it very clearly. Let's try again :)

The so-called "default value" of the registry key:

HKEY_CLASSES_ROOT/.mdb

will have a value, say "xxx". Then, the so-called "default value" of
registry key:

HKEY_CLASSES_ROOT/xxx/shell/open/command

will give you the command that Windows executes when you double-click
an .MDB file.

That command will start with the full pathname of the MSAccess .EXE.

HTH,
TC
 
T

TC

PS.

The windows API that tells you the full pathfilename of the executable
associated with a specified file extension, is called FindExecutable.
If you gave that API the name of an mdb file, it would return the full
pathfilename of the associated executable, ie., the MS Access EXE file.

This might or mightn't be useful to you at this stage. If it is, just
google for:

findexecutable "declare function"

and you will find some examples.

HTH,
TC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top