Howto get path of msaccess.exe ?

A

Al Moben

My question in short:
How do I get the full path of the installed Access 2000 or Access 2000
Runtime application executable (MSACCESS.EXE)?

And now the long version:
I have created an access database (MyDatabase.mdb) which I want to secure
using user-level security. So I run the security wizard, which successfully
secured my database and created a workgroup database (MyWorkgroup.mdw).
Worked well just as the documentation said, ok.

Now in order to open that secured database MyDatabase.mdb, I have to specify
the name of the workgroup database MyWorkgroup.mdw on the commandline, for
example (all in one line of course):

"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE"
"C:\MyPath\MyDatabase.mdb" /WRKGRP "C:\MyPath\MyWorkgroup.mdw"

Ok, that work well, just as the documentation said, the Access's security
wizard created a shortcut with that commandline on my desktop.

And that's my problem: The wizard has created that shortcut on *MY* desktop.
Now I want to send these two files (MyDatabase.mdb and MyWorkgroup.mdw) to
my customer, together with a small installer-application written in VB or
VC++. Now that installer has to create these shortcuts on the *customer's*
machine, where Access (or Access Runtime) might be installed on a drive
other than C: and in a path other than \Program Files\Microsoft Office\...

Creating the shortcut would not be the problem (I know how to do that in VB
or VC++ ir IS), but how do I (programatically) find out the path of the
Access executable on the customer's machine?
 
C

Cameron Sutherland

Its a hard problem but are you in luck because I just did
this. Here is what I did. I made a batch file nd told the
insall package to run it as soon as the instal was done
(last option in the setup wizard). This batch file depends
on you including the shortcuts.exe file from the Option
Pack (BTW this was for NT4 but you can modify for paths
for other OS). The batch file deletes the shortcuts made
by the setup program and recreates its own depending where
it finds the MSAccess.EXE. The hardest part is
understanding the syntax for the shortcuts (paths, icons,
securty files...)
-Cameron Sutherland

*********START icons.bat***********

@echo off
REM -----------------------------------------------
REM Remove shortcuts created by the install program
REM -----------------------------------------------
@if not exist "C:\WINNT\Profiles\"%USERNAME%"\Start
Menu\Programs\Work Request Tracking System" GOTO
SKIP_CLEANUP
@Attrib -h -r "C:\WINNT\Profiles\"%USERNAME%"\Start
Menu\Programs\Work Request Tracking System\*"
@Del "C:\WINNT\Profiles\"%USERNAME%"\Start
Menu\Programs\Work Request Tracking System\*" /F /S /Q
@RD "C:\WINNT\Profiles\"%USERNAME%"\Start
Menu\Programs\Work Request Tracking System"
:SKIP_CLEANUP

REM -----------------------------------------------
REM Remove the files installed in C:\Program Files
REM -----------------------------------------------
@if not exist "C:\Program Files\Work Request Tracking
System" GOTO SKIP_CLEANUP2
@DEL "C:\Program Files\Work Request Tracking System\*" /Q
:SKIP_CLEANUP2
REM -- Depending on developers MSAccess settings below
folders must exist
@if not exist "C:\Data\Access97" MD "C:\Data\Access97"
@if not exist "C:\Program Files\Access97" MD "C:\Program
Files\Access97"

REM -----------------------------------------------
REM Build a new set of shortcuts
REM -----------------------------------------------
@if exist "C:\Program Files\Microsoft
Office\Office\MSACCESS.EXE" SET EXENAME="C:\Program
Files\Microsoft Office\Office\MSACCESS.EXE"
@if exist "C:\Program Files\Access97\Office\MSACCESS.EXE"
SET EXENAME="C:\Program Files\Access97\Office\MSACCESS.EXE"
@if not exist "C:\WINNT\Profiles\All Users\Start
Menu\Programs\Work Request Tracking System"
MD "C:\WINNT\Profiles\All Users\Start Menu\Programs\Work
Request Tracking System"

REM -- Find out if runtime or full install
@if exist "C:\Program Files\Common Files\Microsoft
Shared\VBA\MSO97RT.DLL" SET
SWITCH_LINE="/runtime /wrkgrp """Q:\NonCore\WRTS\Prod\WRTS.
mdw""" """Q:\NonCore\WRTS\Prod\WRTS.mde""""
@if not exist "C:\Program Files\Common Files\Microsoft
Shared\VBA\MSO97RT.DLL" SET
SWITCH_LINE="/wrkgrp """Q:\NonCore\WRTS\Prod\WRTS.mdw""" ""
"Q:\NonCore\WRTS\Prod\WRTS.mde""""

Q:\NonCore\WRTS\Prod\Setup\Shortcut\Shortcut.exe -f -t %
EXENAME% -n "C:\WINNT\Profiles\All Users\Start
Menu\Programs\Work Request Tracking System\Work Request
Tracking System" -d "Q:\NonCore\WRTS\Prod" -a %
SWITCH_LINE% -i "Q:\NonCore\WRTS\Prod\WRTS.ico"
Q:\NonCore\WRTS\Prod\Setup\Shortcut\Shortcut.exe -f -t %
EXENAME% -n "C:\WINNT\Profiles\All Users\Desktop\Work
Request Tracking System" -d "Q:\NonCore\WRTS\Prod" -a %
SWITCH_LINE% -i "Q:\NonCore\WRTS\Prod\WRTS.ico"

Echo Shortcuts have been created successfully.
Pause

*********END icons.bat***********
 
P

Peter Conrad Mangold

Hi Cameron,

your Batchfile tries to locate the MsAccess.exe by inspecting some of the
most common installations locations, "C:\Program Files\Microsoft
Office\Office\MSACCESS.EXE" and "C:\Program
Files\Access97\Office\MSACCESS.EXE". But your approach will most certainly
fail if Access happens to be installed on a different drive ("D:\Programm
Files\..."), or if installed in a different folder (for example on a german
Windows system it's not "C:\Program Files\..." but "C:\Programme\...", and
who knows what it is called on a french/spanish/swedish/... system).

So, is there any way to find out? It doesn't have to be a batch file, it can
be VB, VC, VC++ or something similar which may inspect INI-files or the
registry, but how is it done? The uninstaller for Office knows where to find
it, so the information must be stored somewhere?!?
 
A

Al Moben

Well, that looks like a promising approach to me. I quickly inspected the
registry with RegEdit right now on two different machines, and it points to
the right path in both cases. I'll have to check if this is also the case on
machines which have only the Access Runtime installed, but as Explorer can
open MDB-files with a double click, and Explorer (or Windows) gets its
information out of the registry, this is probably the very place where
Windows itself locates the executable for Access.



Thanks!
 
S

Sidney Linkers

Hi,

Have you tried to call SysCmd(acSysCmdAccessDir) and
SysCmd(acSysCmdGetWorkgroupFile) ?

Good luck!

Sid
 
S

Sidney Linkers

Hi Again,

Do you want to share your solution on creating shortcuts from VB?

Any code or suggestion would be great! Thanks in advance.

Sid
 
M

MacDermott

Frankly, the easy way to do all this is to use the Package and Deployment
Wizard in the Office Developer's Edition.

HTH
- Turtle
 
M

MacDermott

I would not have recommended an application I hadn't used myself -
or at least not without saying so.

Admittedly, the shortcuts it creates are on the Start Menu, not the desktop.
And although it has sometimes taken me several tries, I have been successful
in having it create all of the shortcuts I have needed.

If you would like to post some details of your problems, instead of just
bashing the product, I can see what advice I can offer.

- Turtle
 
P

Paul Overway

As I said, you obviously haven't used PDW. There are many documented
issues....even beyond the many issues related to shortcuts...which do not
get installed under All Users, on the desktop, etc., etc., etc. I'm not
asking for advice, I already know the solution. And I suspect the original
poster does too. DON'T USE PDW.
 
M

MacDermott

I only have serious issues with one part of what you say, and that's the
first sentence, where you claim to have knowledge of what I have and have
not done.

I HAVE used PDW, and found it adequate to my needs, and the needs of my
clients.
Perhaps you have been interviewing my clients without my knowledge, and they
told you I hadn't used it?

I am aware that there are many inadequacies in the PDW, and quite willing to
believe that you have found it was not able to do what you needed done.
But for the simple task of installing a single MDB with a MDW and a
shortcut, it seems like overkill to me to insist on "rolling your own"
installer.

Perhaps, then, since you "know the answer", you'd care to answer the
original poster's question?

- Turtle
 
P

Paul Overway

For any widely distributed app, the solutions is not PDW. I use
Installer2Go and scripts I came up with myself, but there are other
solutions as well, i.e, SageKey with Wise or InstallShield. Given the price
for some of these installers, "rolling your own" may be worthwhile. In any
case, to use PDW for a widely distributed app, you'd have to do serious
customization or develop work-arounds. And it would still far short. PDW
is lame. If you have the time to spend assisting clients with installs
generated by PDW, have at it. I've got better things to do.
 
D

david epsom dot com dot au

Cut from Shortcut.vbs, the MS VBS example:

----------
Dim WSHShell
Set WSHShell = WScript.CreateObject("WScript.Shell")


Dim MyShortcut, MyDesktop, DesktopPath

' Read desktop path using WshSpecialFolders object
DesktopPath = WSHShell.SpecialFolders("Desktop")

' Create a shortcut object on the desktop
Set MyShortcut = WSHShell.CreateShortcut(DesktopPath & "\Shortcut to
notepad.lnk")

--------
That creates a shortcut on my desktop: you want to create a shortcut on the
'all users' desktop. That means you have to work out the DeskTopPath for
'all users'. I leave that as an excersise for the reader.

Ordinary users won't have permission to create the shortcut.
 

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

Similar Threads


Top