DOCUMENT:Q173796 23-NOV-2000 [accother] TITLE :ODE97: Print Command Not Available in Run-Time Applications PRODUCT :Microsoft Access Distribution Kit PROD/VER:WINDOWS:97 OPER/SYS: KEYWORDS:kbdta ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft Office 97 Developer Edition ------------------------------------------------------------------------------- Moderate: Requires basic macro, coding, and interoperability skills. 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. CAUSE ===== Some menu commands, such as the Print command from the default File menu, are disabled in the run-time environment. RESOLUTION ========== Use either of the following two methods. Method 1: Use the Command Bar Wizard ------------------------------------ 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: Q172300 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. Method 2: Call a Custom Print Function -------------------------------------- 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