Creating an Application Shortcut


When you’re all done, you might need to create a way for users to easily start your application. If your users all have a copy of Access, you could give them your database application files and simply instruct them to open the appropriate file. But what if the user doesn’t have Access, so you have to set them up to execute your application with the runtime version of Access? What if you want to also define certain utility functions that the user might need to execute from time to time? The answer is to create a shortcut.

You use shortcuts all the time in Windows to start programs on your computer. When you install an application on your computer, the setup program usually creates a shortcut that it adds to your Start menu. Some setup programs also add a shortcut on your desktop. The icon for a shortcut on your desktop has a small white box in the lower-left corner with an arrow in it. You can right-click a shortcut and choose Properties from the shortcut menu to see the definition of the shortcut.

To create a shortcut on your Windows desktop for your Access application, right-click the desktop, click New, and then click Shortcut. You can also create a shortcut in a folder by opening Windows Explorer, navigating to the folder you want, pressing the Alt key to view the menu bar, clicking New on the File menu, and then clicking Shortcut. In either case, Windows opens the Create Shortcut wizard to help you find the program you want the shortcut to open. Click the Browse button, and find C:\Program Files\Microsoft Office\Office12\MSACCESS.EXE. Click OK to select the file, and then click the Next button. Give your shortcut a name, such as the name of the database you plan to open with the shortcut, and then click Finish.

Right-click your new shortcut, and click Properties. You’ll see a dialog box similar to the one shown in Figure 25–3.

image from book
Figure 25–3: You can modify the Target setting for a Windows shortcut in the shortcut’s Properties dialog box.

At the top of the Shortcut tab is the icon the shortcut displays and the name of the shortcut. You can click the General tab and enter a new name to rename your shortcut. Target Type tells you that this shortcut starts an application. Target Location displays the original location of the program that this shortcut starts. The Target box allows you to specify the program or file that you want to run. Note that at this point your new shortcut starts only the Access program-it doesn’t specify a file to open or any parameters. You can specify the database file name and enter any parameters used by the program in the Target box.

Immediately following the name of the Access program in the Target box, enter a space followed by the database you want to open (with its full path). If the path or file name contains any blanks or special characters, you must enclose the file path in double quotes. Follow the name of the database with the options you need to perform the task you want. For example, to open the Housing.accdb sample database from the default installation, the target setting in this shortcut is as follows:

 "C:\Program Files\Microsoft Office\Office12\MSACCESS.EXE"    "C:\Microsoft Press\Access 2007 Inside Out\Housing.accdb"

Note 

You can also specify only the name of a database file in the Target box in a shortcut, and Windows opens the program that can process this file (in this case, Access) when you double-click the shortcut However, Access won’t recognize any parameters that you include after the file name. You must specifically ask to open the Access program (MSACCESS.EXE) and add the file name and parameters.

Table 25–1 summarizes the shortcut command-line options you can use. When you include multiple command-line options, separate each with a space.

Table 25–1: Access Shortcut Command-Line Options
Open table as spreadsheet

Option

Description

<database>

Opens the specified database. If the path or file name contains blanks, you must enclose the string in double quotes. Must be the first option after the folder and file location for MSACCESS.EXE.

/cmd <command string>

Specifies a program parameter that can be retrieved by a Visual Basic procedure using the built-in Command function. Must be the last option on the command line.

/compact [<target>]

Compacts and repairs the specified database but does not open the database. If you omit the target file name, Access compacts the database into the original file name and location.

/convert <target>

Converts the specified version 11 or earlier database to Access 2007 file format and stores it in the target file.

/excl

Opens the specified database with exclusive access. Only one user at a time can use a database that is opened exclusively.

/profile <userprofile>

Specifies the name of a user profile in the Windows registry. You can use a profile to override database engine settings and specify a custom application title, icon, or splash screen.

/pwd <password>

Specifies the password for the user named in the /user parameter. If the password contains the / or; character, enter the character twice. For example, if the password is #ab/ cd;de, enter #ab//cd;;de. This option applies to Access 2003 and earlier (.mdb) format databases that have user-level security implemented.

/repair

Repairs the specified database but does not open the database.

/ro

Opens the specified database in read-only mode.

/runtime

Specifies that Access will execute with runtime version options.

/user <userid>

Specifies the logon user ID. This option applies to Access 2003 and earlier (.mdb) format databases that have userlevel security implemented.

/wrkgrp < workgroupfile >

Uses the specified workgroup file. This option applies to Access 2003 and earlier (.mdb) format databases that have user-level security implemented.

/x macroname

Runs the specified macro after opening the specified database.

Using a command-line option, you can also create a shortcut to perform the maintenance task of compacting your database. For example, to compact the Contacts.accdb database and save the compacted version to a file named ContactsCompact.accdb in the same folder, enter the following in the Target box:

 "C:\Program Files\Microsoft Office\OFFICE12\MSACCESS.EXE"     "C:\Microsoft Press\Access 2007 Inside Out\Contacts.accdb" /compact     "C:\Microsoft Press\Access 2007 Inside Out\ContactsCompact.accdb"

This previous text assumes you’ve installed the sample files in the default folders. In the Start In box, specify the starting folder for the application. In the Shortcut Key box, you can enter a single letter or number that the user can press with Ctrl+Alt+ to run the shortcut. The shortcut key must be unique for all shortcuts on your system. In the Run list, you can choose to start the application in a normal-size window (the default), minimized as an icon on your taskbar, or maximized to fill your screen. In the Comment box, you can enter text that appears when the user rests the mouse pointer on the shortcut.

Click the Open File Location button to verify that the target you entered is valid. Click the Change Icon button to select a different icon stored within the target program (MSACCESS.EXE has 68 available icons) or to locate an icon file on your hard disk. Click the Advanced button if you need to set up this shortcut to run under a specific Windows user ID.

On the Compatibility tab of the Properties dialog box, you can find an option to run the program in compatibility mode as though it’s running on an older operating system such as Windows 2000 or Windows XP. You can also force your display to 256 colors, use 640×480 screen resolution, or disable Windows themes when this program runs. On the Security tab, you can allow or deny permissions to use this shortcut for specific Windows users or groups.

After you have completed the settings you want, click OK to save your changes to the shortcut. You can now double-click the shortcut to run the program with the options you specified.




Microsoft Office Access 2007 Inside Out
MicrosoftВ® Office Access(TM) 2007 Inside Out (Microsoft Office Access Inside Out)
ISBN: 0735623252
EAN: 2147483647
Year: 2007
Pages: 234

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net