UtterAccess HomeUtterAccess Wiki

Welcome Guest ( Log In | Register )

Edit Discussion
> Command-Line Switches    
Command-Line Switches

Microsoft Access is usually run from the Start menu or by double-clicking on an Access database file. What is not usually done is to run Access using the command line (DOS window). However, if Access is started using the DOS window, there are some command-line switches available to modify the behavior of the program during startup.


Contents

Command-Line Switches

The following table shows the available command-line switches for Microsoft Access:

SwitchPurpose
/exclOpens the database file in exclusive mode.
/roOpens the database file in read-only mode.
/user usernameOpens the database file using the supplied username
/pwd passwordOpens the database file using the password supplied
/profile userprofileOpens the database file using the options in the user profile instead of the default settings.
/compact filepathCompacts and repairs the database file to a different file. If filepath is not used, the original database file is compacted.
/convert filepathConverts the database file to an upgraded version.
/x macronameExecutes the specified macro at startup.
/cmdUsed to pass an argumet that can be retrieved using the Command() function in Access.
/nostartupStarts Access without displaying the startup dialog box.
/wrkgrp filepathStarts Access using the supplied .mdw security file.
/runtimeStarts Access in RunTime mode.


Examples

  • To open a database file in exclusive mode
C:\FullPathTo\MSACCESS.EXE C:\FullPathTo\Database.mdb /excl
  • To open a database file in read-only mode
C:\FullPathTo\MSACCESS.EXE C:\FullPathTo\Database.mdb /ro
  • To open a database file and execute a macro called "startup"
C:\FullPathTo\MSACCESS.EXE C:\FullPathTo\Database.mdb /x startup
Note: To have a macro run each time the database is opened, name it "autoexec."
  • To open a secured database using a workgroup file called "mysecurity.mdw"
C:\FullPathTo\MSACCESS.EXE C:\FullPathTo\Database.mdb /wrkgrp C:\FullPathTo\mysecurity.mdw
  • To start up Access in RunTime mode
C:\FullPathTo\MSACCESS.EXE C:\FullPathTo\Database.mdb /runtime

Note: If any part of the path or the filename contains spaces, you should enclose it with double quotes.

Edit Discussion
Thank you for your support!
This page has been accessed 12,074 times.  This page was last modified 19:44, 21 January 2012 by Jack Leach. Contributions by pacala_ba, Walter Niesz, Ace and TheDBguy  Disclaimers