DetailPage-MSS-KB

Microsoft small business knowledge base

Article ID: 209207 - Last Review: July 12, 2013 - Revision: 5.4

This article was previously published under Q209207
For a Access 97 version of this article, see 105128  (http://support.microsoft.com/kb/105128/ ) .
Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

On This Page

Summary

When you run Microsoft Access from the Start menu or a shortcut menu, you can use command-line switches to modify the startup process. For example, you can open a particular database, run a macro, or supply a password.

More information

The following table lists the Microsoft Access command-line options.
   Option       Effect                                    Applies to
   -----------------------------------------------------------------
   database     Opens the specified Microsoft Access      Access 
                database or Microsoft Access project.     database or 
                Include a path if necessary. If you are   Access 
                running Windows 95, the default path is   project
                your My Documents folder.	
                            
   /excl        Opens the specified Access database for   Access 
                exclusive access. To open the database    database 
                for shared access in a multiuser          only
                environment, omit this option. 
	
   /ro          Opens the specified Access database or    Access 
                Access project for read-only access.      database or 
                                                          Access 
                                                          project

   /user        Starts Access using the specified user    Access 
   user name    name.                                     database 
                                                          only

   /pwd         Starts Access using the specified         Access 
   password     password.                                 database 
                                                          only

   /profile     Starts Access using the options in the    Access 
   user         specified user profile instead of the     database or 
   profile      standard Microsoft Windows registry       Access 
                settings created when you installed       project
                Access. This replaces the /ini option  	
                used in versions of Access earlier   	
                than Access 97 to specify an   	
                initialization file.

   /compact     Compacts and repairs the Access           Access 
   target       database, or compacts the Access project, database or 
   database or  specified before the /compact option and  Access 
   target       then closes Access. If you omit a target  project
   Access       file name following the /compact option, 	
   project      the file is compacted to the original  	
                name and folder. To compact to a different  
                name, specify a target file. If you don't 	
                include a path in target database or target 	
                Access project, the target file is created  	
                in your My Documents folder by default. In 	
                an Access project, this option compacts 	
                the Access project (.adp) file but not the 	
                SQL Server database. 
	
   /repair      Repairs the Access database specified     Access 
                before the /repair option and then        database 
                closesAccess. In Access 2000, compact     only
                and repair functionality is combined  	
                under /compact. The /repair option is 	
                supported for backward compatibility. 
	
   /convert     Converts an Access database in an         Access 
   target       earlier version to an Access 2000         database 
   database     database with a new name and then closes  only
                Access. Specify the source database  	
                before using the /convert option. 	

   /x  macro    Starts Access and runs the specified      Access 
                macro. Another way to run a macro when    database or 
                you open a database is to use an          Access 
                AutoExec macro.                           project
                             
   /cmd         Specifies that what follows on the        Access 
                command line is the value that will be    database or 
                returned by the Command function. This    Access 
                option must be the last option on the     project
                command line. You can use a semicolon (;)	
                as an alternative to /cmd. 	

   /nostartup   Starts Access without displaying the      Access 
                startup dialog box (the second dialog     database or 
                box that you see when you start Access).  Access 
                                                          project

   /wrkgrp      Starts Access using the specified         Access 
   workgroup    workgroup information file.               database 
   information                                            only
   file

   /runtime     Starts Access in run-time mode.           Accesss 
                                                          database or 
                                                          Access 
                                                          project

Notes

  • To run a Visual Basic for Applications procedure when you open a database, use the RunCode action in the AutoExec macro or in the macro that you run by using the command-line option /x. You can also run a Visual Basic procedure when you open a database by creating a form with a Visual Basic procedure defined for its OnOpen event. Designate this form as the startup form by right-clicking the Database window, clicking Startup, and then entering that form in the Display Form/Page box.
  • To specify a forward slash (/) or semicolon (;) on the command line, type the character twice. For example, to specify the password ;mjs/md on the command line, type ;;mjs//md following the /pwd command-line option.
  • Examples:

    You can type the following command in the Run dialog box to open an Access 2000 database in exclusive mode that runs the specified macro at the startup:
    "C:\Program Files\Microsoft Office\Office\msaccess.exe" "C:\Program Files\Microsoft Office\Office\samples\northwind.mdb" /Excl /X Add Products
    To open an Access 2002 database in exclusive mode that runs the specified macro at the startup, type the following command in the Run dialog box:
    "C:\Program Files\Microsoft Office\Office10\msaccess.exe" "C:\Program Files\Microsoft Office\Office10\samples\northwind.mdb" /Excl /X Add Products
    Similarly, if you want to open an Access 2003 database in exclusive mode that runs the specified macro at the startup, type the following command in the Run dialog box:
    "C:\Program Files\Microsoft Office\Office11\msaccess.exe" "C:\Program Files\Microsoft Office\Office11\samples\northwind.mdb" /Excl /X Add Products

References

For more information about how to troubleshoot invalid page faults, click the following article number to view the article in the Microsoft Knowledge Base:
208488  (http://support.microsoft.com/kb/208488/ ) How to troubleshoot invalid page faults in Microsoft Access 2000
For more information about using /Pwd option , click the following article numbers to view the articles in the Microsoft Knowledge Base:
207891  (http://support.microsoft.com/kb/207891/ ) Can't use /pwd option with password-protected database in Access 2000
292302  (http://support.microsoft.com/kb/292302/ ) Can't use /pwd option with password-protected database in Access 2002
For more information about using the switches while creating the distributable runtime package, click the following article number to view the article in the Microsoft Knowledge Base:
236519  (http://support.microsoft.com/kb/236519/ ) How to write macros and switches for shortcuts in the Package and Deployment Wizard
For more information about using the /convert switch, click the following article number to view the article in the Microsoft Knowledge Base:
319253  (http://support.microsoft.com/kb/319253/ ) How to use command line switch /convert to convert database only into Access 2000 file format
For more information about the problem while opening the Access database by using a custom profile, click the following article number to view the article in the Microsoft Knowledge Base:
266769  (http://support.microsoft.com/kb/266769/ ) Error starting Microsoft Access 2000 with custom profile
For more information about command-line switches, click Microsoft Access Help on the Help menu, type startup command-line options in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

Applies to
  • Microsoft Office Access 2003
  • Microsoft Access 2002 Standard Edition
  • Microsoft Access 2000 Standard Edition
Keywords: 
kbstartprogram kbopenfile kbhowto kbinfo kbui KB209207
Share
Additional support options
Ask The Microsoft Small Business Support Community
Contact Microsoft Small Business Support
Find Microsoft Small Business Support Certified Partner
Find a Microsoft Store For In-Person Small Business Support