Hello,
I have a problem while opening an access database through a batch file.
We work on a network and all of us having different version of ms access installed on the system. We have a batch file which allows us to open the database & work. The code in the batch file is as below:
@echo off
cls
title Launching database...
rem ----------------------------------------------------- SET PATHS
set TargetMdw="C:\Program Files\Microsoft Office xp\OFFICE10\System.mdw"
Set TargetMdb="\\xyz-server\Jan\SR Track.mdb
Set RTAccess="C:\Program Files\Microsoft Office xp\OFFICE10\msaccess.exe"
rem ----------------------------------------------------- TESTING
echo.
echo Checking For MS Access Runtime ...
if not exist %RTAccess% goto ERRnoRT
echo.
echo Locating the Database ...
if not exist %TargetMdb% goto ERRbathpath
rem ----------------------------------------------------- OPENING
echo.
echo Opening the database ...
cd\
c:
cd "program files\Microsoft Office xp\Office10"
msaccess.exe /runtime /wrkgrp %TargetMdw% %TargetMdb%
echo.
echo Closing the database ...
goto end
rem ----------------------------------------------------- ERROR HANDLING
:ERRnoRT
echo Error: No MS Access Runtime
echo Ensure you have opened at least one MS Office application
echo.
pause
goto end
:ERRbathpath
echo File Not Found
echo You don't have access to the the network path - Please raise a request.
echo.
pause
goto end
rem ----------------------------------------------------- END
:End
echo.
echo goodbye
If I have ms access 2003 installed on my machine, I won't be able to run the batch file with above code. I need a code which detects the right version and opens the database. A system might have multiple versions of access installed like access 97, access 2000, access 2002, access 2003, access 2007 & so on. Is there a way which reads the versions one-by-one & selects the latest one to launch with? The intension is to eliminate manual work each time.
Please help...
Mac
I have a problem while opening an access database through a batch file.
We work on a network and all of us having different version of ms access installed on the system. We have a batch file which allows us to open the database & work. The code in the batch file is as below:
@echo off
cls
title Launching database...
rem ----------------------------------------------------- SET PATHS
set TargetMdw="C:\Program Files\Microsoft Office xp\OFFICE10\System.mdw"
Set TargetMdb="\\xyz-server\Jan\SR Track.mdb
Set RTAccess="C:\Program Files\Microsoft Office xp\OFFICE10\msaccess.exe"
rem ----------------------------------------------------- TESTING
echo.
echo Checking For MS Access Runtime ...
if not exist %RTAccess% goto ERRnoRT
echo.
echo Locating the Database ...
if not exist %TargetMdb% goto ERRbathpath
rem ----------------------------------------------------- OPENING
echo.
echo Opening the database ...
cd\
c:
cd "program files\Microsoft Office xp\Office10"
msaccess.exe /runtime /wrkgrp %TargetMdw% %TargetMdb%
echo.
echo Closing the database ...
goto end
rem ----------------------------------------------------- ERROR HANDLING
:ERRnoRT
echo Error: No MS Access Runtime
echo Ensure you have opened at least one MS Office application
echo.
pause
goto end
:ERRbathpath
echo File Not Found
echo You don't have access to the the network path - Please raise a request.
echo.
pause
goto end
rem ----------------------------------------------------- END
:End
echo.
echo goodbye
If I have ms access 2003 installed on my machine, I won't be able to run the batch file with above code. I need a code which detects the right version and opens the database. A system might have multiple versions of access installed like access 97, access 2000, access 2002, access 2003, access 2007 & so on. Is there a way which reads the versions one-by-one & selects the latest one to launch with? The intension is to eliminate manual work each time.
Please help...
Mac