Microsoft has a great article about this subject here.
There is also this knowledge base article 207854--ACC2000: Cannot Rename or Delete Custom Shortcut Menus
One way, I feel, to make your database a lot more professional and customized with the end-user in mind is to eliminate the normal toolbars and drop-down menu options from the database in the front-end. As a very good example of this, the 'print' icon showing up while a user has a form open (as opposed to a report) is deceptive; an end-user may think that, say, to print the current record being displayed they should just click the normal print-icon showing up on the toolbar, just like when they're in (let's say) Microsoft Word--or they should select "File...Print" from the pull-down menu. As you almost certainly know, the results aren't professional, to say the least. Also, end-users, don't need to see, for example, "Tools....Relationships" or "Tools...ActiveX Controls" as drop-down options while running the database as an end-user (as opposed to as a designer). Below is an example of exactly what I'm referring to:
If the user clicked the printer icon as shown here, the results would be disastrous.
Oh, the violations of this common-sense rule which exist above. How many? Geez, for starters:
Here are the basics you need to know about designing custom menus & toolbars
The Steps |
Here is a custom menu being created. The toolbar is off to the right, and the toolbox for creating the commands is called "customize." You would drag the buttons from the "customize" box to the toolbar, right-click, select PROPERTIES and set it up from there. ![]() |
Type of Toolbar | Example of Name |
Toolbar | tbrName |
Pull-down Menu | tbrMenuName |
Right-click Menu | tbrRightClickName |
If you intend to make this a regular toolbar or right-click menu--as opposed to a pull-down menu--then skip the next step. Otherwise:
If the command execting is not "preset" and needs to be customized to execute, this would be accomplished by way of code entered into the database's MODULE section which the buttons on the command bars refer to.
Let's start off the simple way--by getting rid of the standard toolbars and drop-down menus:
Go to "Tools...Startup." UNcheck the "Allow Built-in Toolbars" option.
Now, the standard toolbars as shown above no longer show up at all. Obviously, if you're still designing the database, this cramps your style. But for an end-product oriented around the end-user, the results are FAR more professional.
This doesn't happen globally; you have to apply it for each form you wish for it to apply to.
Open the form in DESIGN view. Select "Properties" (or double-click the square in the top-left corner of the form where the square dot is.) Go to the OTHER tab. Enter the value =1 (including the = sign).
With each button, hover over it, select PROPERTIES and type the command in On Action.
One example: for a SHOW ALL button, the following code would appear in the MODULE:
Function showallmolds() Forms!browse_form.Form.RecordSource = "mold_query" Forms!browse_form.Form.StatusBox = "Showing ALL Records" End Function |
In the command button assigned to execute this code, the syntax would be =showallmolds().
Here are some other samples of code in the module for executing commands (derived from my 2001 TOOLING database
Function addcomment() 'DoCmd.GoToControl "issues_comments" Forms!mold_form_main.comments.SetFocus End Function '------------------------------------------------------- '------------------------------------------------------- Function addnewmold() DoCmd.OpenForm "mold_form_main", acNormal, "", "", acAdd, acNormal End Function '------------------------------------------------------- '------------------------------------------------------- Function printmolds() DoCmd.OpenReport "mold_info_landscape", acViewPreview End Function '------------------------------------------------------- '------------------------------------------------------- Function showallmolds() Forms!browse_form.Form.RecordSource = "mold_query" Forms!browse_form.Form.StatusBox = "Showing ALL Records"Tuesday, April 02, 2002 End Function '------------------------------------------------------- '------------------------------------------------------- Function todaysmolds() Dim sSQL As String sSQL = "SELECT mold_table.* FROM mold_table WHERE (((mold_table.date_modified)=Date())) " _ & "ORDER BY mold_table.time_modified DESC;" Forms!browse_form.Form.RecordSource = sSQL Forms!browse_form.Form.StatusBox = "Showing Molds Modified Today" End Function '------------------------------------------------------- '------------------------------------------------------- Function printsamples() DoCmd.OpenReport "samples_landscape_1", acViewPreview End Function '------------------------------------------------------- '------------------------------------------------------- Function showallsamples() Forms!browse_samples_form.Form.RecordSource = "samples_query" Forms!browse_samples_form!StatusBox = "Showing All Entries" Forms!browse_samples_form.Form.Caption = "Showing All Entries" 'Forms!browse_samples_form!Form.status_original = Me.StatusBox ' This code lets the form StatusBox show the sort order, too End Function '------------------------------------------------------- '------------------------------------------------------- Function anpnsort() On Error GoTo Macro1_Err Forms!browse_form.Form.OrderBy = "assembly_name,mold_description" Forms!browse_form.Form.OrderByOn = True Macro1_Exit: Exit Function Macro1_Err: MsgBox Error$ Resume Macro1_Exit End Function '------------------------------------------------------- '------------------------------------------------------- Function emailreport() ' Email Open Report On Error GoTo Macro1_Err Dim strRep As String ' LarryTucAZ@Yahoo.com strRep = Reports(0).name ' The above 2 lines detect which report is currently open and assign that value to strRep DoCmd.SendObject acReport, strRep, "SnapshotFormat(*.snp)", "", "", "", "samples report", _ & "here is a sample report. Make sure you have 'Snapshot Viewer' " _ & "installed in order to read this report", False, "" Macro1_Exit: Exit Function Macro1_Err: MsgBox Error$ Resume Macro1_Exit End Function '------------------------------------------------------- '------------------------------------------------------- Function printreport() ' Print Open Report On Error GoTo Macro1_Err DoCmd.SelectObject acReport, Reports(0).name DoCmd.RunCommand acCmdPrint Macro1_Exit: Exit Function Macro1_Err: MsgBox Error$ Resume Macro1_Exit End Function '------------------------------------------------------- '------------------------------------------------------- Function closereport() ' Close Active Report On Error GoTo Macro1_Err Dim strRep As String ' LarryTucAZ@Yahoo.com strRep = Reports(0).name ' The above 2 lines detect which report is currently open and assign that value to strRep DoCmd.Close DoCmd.Close acReport, strRep Macro1_Exit: Exit Function Macro1_Err: MsgBox Error$ Resume Macro1_Exit End Function '------------------------------------------------------- '------------------------------------------------------- Function showallpurchasereqs() Forms!purch_req_browse_form.Form.RecordSource = "purchase_req_query" Forms![purch_req_browse_form]![purchase_req_all_datasheet_form].Form.RecordSource = "purchase_req_query" End Function |