Batch File for Opening Secured Databases

TastyWheat

Registered User.
Local time
Today, 16:57
Joined
Dec 14, 2005
Messages
125
I'm sure most people use Windows shortcuts to open their secured databases, but I found that it didn't always work (depending on which computer I used). Editing a shortcut is pretty confusing since the command is all on one line. I decided to make a batch file to open my secured databases instead. Here's a batch file I use to open a database of mine:
Code:
@ECHO OFF

REM - Set variables to be used in the batch file.

SET BACK=Z:\Bob\Manager List\db_be.mdb
SET FRONT=Z:\Bob\Manager List\db_fe.mdb
SET WRKGRP=Z:\Bob\Manager List\Secured.mdw
SET OFFICE=C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE
IF EXIST "%OFFICE%" GOTO PROMPT
SET OFFICE=C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE
GOTO PROMPT

REM - Ask the user which end to open.

:PROMPT
CLS
SET /P dbChoice=Do you wish to open the frontend(1) or the backend(2)? 

if "%dbChoice%" == "1" (
   "%OFFICE%" "%FRONT%" /wrkgrp "%WRKGRP%"
   GOTO END
)
if "%dbChoice%" == "2" (
   "%OFFICE%" "%BACK%" /wrkgrp "%WRKGRP%"
   GOTO END
)
:END
This isn't the simplest batch file ever, but if you want to use this you just need to change the paths to your frontend, backend, workgroup file, and your version of Access. If Office was installed in the default location you shouldn't need to change those lines, unless you know you'll always be using the same version of Access.
 
Thanks, I'm sure this will prove useful to me at some stage :)

Peter
 

Users who are viewing this thread

Back
Top Bottom