Sunday, March 15, 2009

Startup options for Microsoft Access

You can add command line switches when opening up access via a shortcut or bat file.

To go one step further we had to also use a specific security file.

See below for the bat file script:

@echo off
"C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE" %~dp0MyDatabase.mdb /wrkgrp %~dp0MySystem.mdw
cls
@exit

This opens using access 2003 a database called MyDatabase and a Security file caled MySystem.

What is nice is that everything is relative to where the script lives...

Apparently this opens in shared mode and the other command line options are:

/excl   exclusive access.
/ro read-only access.
/user Starts Access using the specified user name
/pwd Starts Access using the specified password
/excl Opens the specified Access database for exclusive access.
To open the database database for shared access in a multiuser only environment, omit this option.
/x macro Starts Access and runs the specified macro.
Another way to run a macro when you open a database is to use an Access AutoExec macro.
/cmd Specifies that what follows on the command line is the value that will be returned by the Command function.
This 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 startup dialog box
/wrkgrp Starts Access using the specified workgroup information file. database
/runtime Starts Access in run-time mode.

And these look good to use if you want to schedule compact and repair etc
Although, we put temp tables in separate tables to avoid database bloat and conflicts, so compact and repair isn't required.

/compact [target database] Compacts and repairs the Access database
/convert [target database] Converts an Access database in an earlier version
* Specify the source database before using the /convert option.

For any more detail just Google:
"How to use command-line switches in Microsoft Access"

###
Thinking of Migrating Access to Sql Server?
Talk to the guys who know all the tricks....
http://www.macroview.com.au

No comments: