This article was previously published under Q173796
Moderate: Requires basic macro, coding, and interoperability skills.
On This Page
SYMPTOMS
When you build a custom menu bar in Microsoft Access 97 and include the
built-in File menu, some commands do not appear on the menu in the run-time environment. For example, the Print command does not appear on the menu; as a result, you cannot modify the printer settings or properties.
You can use the Command Bar Wizard to replace the default menu bar with a
custom menu bar. For more information about obtaining the Command Bar Wizard, please see the following article in the Microsoft Knowledge Base:
172300 (http://support.microsoft.com/kb/172300/EN-US/) ACC97: Command Bar Wizard Available in Download Center
Follow these steps to create a custom menu bar using the Command Bar
Wizard:
1.
Open your database in Microsoft Access 97.
2.
On the Tools menu, point to Add-ins, and then click Command Bar Wizard.
3.
Under Select Type in the Command Bar Wizard dialog box, click New, and then click Next.
4.
In the Select Template list, click Database, and then click Next.
5.
Click Next, and then type a name for the menu in the Menu Name box.
6.
Click Build.
NOTE: The Command Bar Wizard will create a new menu and close any
existing menus. You can dock the custom menu bar or move it to any
location on the screen.
7.
On the Tools menu, click Startup.
8.
In the Startup dialog box, type or select your menu in the Menu Bar box.
9.
Click OK.
Note that the Print command is available when you open this database in the
run-time environment, either by running a Microsoft Access application
installed from disk images created with the Microsoft Office 97 Developer
Edition or by running Microsoft Access using the /runtime switch. When you click Print, the Print dialog box appears.
You can create a Microsoft Visual Basic for Applications function that
displays the Print dialog box and attach that function to a custom Menu Bar. To do so, follow these steps:
1.
Open your database in Microsoft Access 97.
2.
In the Database window, click the Modules tab, and then click New.
3.
Type the following code in the module that you just created:
Public Function PrintOut()
' Attached to a custom Print command on a custom menu bar.
' Use the RunCommand method to display the print dialog box.
On Error GoTo ErrorTrap
DoCmd.RunCommand acCmdPrint
Exit Function
ErrorTrap:
' Check whether the RunCommand method was canceled.
' If RunCommand is canceled, it generates a trappable
' run-time error (2501).
If Err.Number = 2501 Then
Exit Function
Else
MsgBox Err.Number & vbCRLF & Err.Description
End If
End Function
4.
On the Debug menu, click Compile Loaded Modules.
5.
Save the module as basPrintFunction.
Follow these steps to create the custom menu bar:
1.
On the View menu, point to Toolbars, and then click Customize.
2.
Click the Toolbars tab, and then click New.
3.
In the New Toolbar dialog box, type a name in the Toolbar name box, and then click OK.
4.
In the Customize dialog box, click Properties.
5.
In the Toolbar Properties dialog box, click Menu Bar in the Type list, and then click Close.
6.
In the Customize dialog box, click the Commands tab, and then click New Menu in the Categories list.
7.
Drag New Menu from the Commands box to your custom menu bar.
8.
On your custom menu bar, right-click New Menu and type a name for the menu in the Name box. Press ENTER.
9.
In the Customize dialog box, click File in the Categories box, and drag Custom from the Commands box to your new menu.
NOTE: When you drag the Custom command over the name of your new menu, it will create a blank menu. It is on this blank menu that you
should place the Custom command.
10.
On your custom menu bar, right-click the Custom command from step 9 and type a command name, such as Print, in the Name box, and then click Properties.
11.
In the <menu name> Control Properties dialog box, type =PrintOut() in the On Action box, and then click Close.
12.
Add any additional menu commands that you need in the same manner.
13.
In the Customize dialog box, click Close.
14.
On the Tools menu, click Startup.
15.
In the Startup dialog box, type or select your menu in the Menu Bar box.
16.
Click OK.
When you open your database in the run-time environment, either by running
a Microsoft Access application installed from disk images created with the
Microsoft Office 97 Developer Edition Tools or by running Microsoft Access
using the /runtime switch, note that the Print command is now available. When you click Print, the Print dialog box appears.
WARNING: The following steps change the StartUpMenuBar property of the Northwind sample database. You may want to back up the Northwind.mdb file and perform these steps on a copy of the database.
For more information about changes in the run-time environment, search the
Microsoft ODE Tools Help Index for "disabled" or "disabled features in run-
time environment."
For additional information about differences between the retail and run-
time versions of Microsoft Access, please see the following article in the
Microsoft Knowledge Base:
162521 (http://support.microsoft.com/kb/162521/EN-US/) ACC97: Differences Between Retail and Run-Time Microsoft Access
For additional information about getting help with Visual Basic for
Applications, please see the following article in the Microsoft Knowledge
Base:
163435 (http://support.microsoft.com/kb/163435/EN-US/)
VBA: Programming Resources for Visual Basic for Applications
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.