Help and Support

HOW TO: Open Microsoft Access 2000 to a Specific Form by Using a Shortcut

Article ID:207672
Last Review:June 24, 2004
Revision:2.0
This article was previously published under Q207672
On This Page

SUMMARY

This article describes how you can create two types of shortcuts on the Windows 95 or later desktop, both of which start an Access database and open to a form of your choosing. You can create such a shortcut either by dragging the form from the Database window to the desktop or by using the /cmd command-line switch.

CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

Back to the top

Method 1

You can drag a form from the Database window directly to the desktop. To do so, follow these steps:
1.Open the sample database Northwind.mdb.
2.Select the Customers form in the Database window.
3.Restore and position Microsoft Access so that you can see both the desktop and Microsoft Access.
4.Drag the Customers form to the desktop. Note that you now have a shortcut on your desktop named "Shortcut to Customers in Northwind."
5.Close Microsoft Access.
6.Double-click the shortcut on the desktop. Note that Microsoft Access starts with the Customers form of the sample database Northwind.mdb open.

Back to the top

Method 2

The following example demonstrates how you can create two shortcuts that start Access and open either the Orders or the Employees form:
1. Right-click the desktop, point to New, and then click Shortcut.
2.In the Create Shortcut dialog box, create the following two shortcuts (one at a time) with the following command-lines:

NOTE: In the following example, an underscore (_) at the end of a line is used as a line-continuation character. Remove the underscore from the end of the line when re-creating this sample.
   C:\Program Files\Microsoft Office\Office\Msaccess.exe _
   C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb _
   /cmd "Orders"
						
   C:\Program Files\Microsoft Office\Office\Msaccess.exe _
   C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb _
   /cmd "Employees"
						
NOTE: These shortcuts assume that Microsoft Access is installed in the C:\Program Files\Microsoft Office\Office\ folder.
3. Open the sample database Northwind.mdb and create the following function in a new module:
Function CheckCommandLine()
    ' Check value returned by Command function.
    If Command = "Orders" Then
         DoCmd.OpenForm "Orders"
    ElseIf Command = "Employees" Then
         DoCmd.OpenForm "Employees"
    Else
    Exit Function
    End If
 End Function
					
4.Create a new macro as follows and save it as AutoExec:
Action
-------
RunCode

AutoExec Actions
-----------------------------------
RunCode

Function Name: CheckCommandLine()
5.Close Microsoft Access. On the desktop, double-click the first shortcut. Note that Microsoft Access starts with the Orders form of the sample database Northwind.mdb open.
6.Close Microsoft Access. On the desktop, double-click the second shortcut. Note that Microsoft Access starts with the Employees form of the sample database Northwind.mdb open.
If you click Options on the Tools menu, and then click the Advanced tab, you will see the /cmd value in the Command-Line Arguments box.




Back to the top

REFERENCES

For more information about command-line switches, click Microsoft Access Help on the Help menu, type command-line in the Office Assistant or the Answer Wizard, and then click Search to view the topic.










Back to the top


APPLIES TO
Microsoft Access 2000 Standard Edition

Back to the top

Keywords: 
kbhowto kbhowtomaster KB207672

Back to the top

Article Translations

 

Related Support Centers

Other Support Options

  • Need More Help?
    Contact a Support professional by Email, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.