Microsoft KB Archive/282370

= ACC2002: MaxRecButton Property Setting Does Not Affect Maximum Records Command on the Records Menu =

Article ID: 282370

Article Last Modified on 6/23/2005

-

APPLIES TO


 * Microsoft Access 2002 Standard Edition

-



This article was previously published under Q282370



Moderate: Requires basic macro, coding, and interoperability skills.

This article applies only to a Microsoft Access project (.adp).



SYMPTOMS
The Maximum Records command on the Records menu of a form is not affected when you set the MaxRecButton property of a form. For example, when you set the MaxRecButton property of the form to No, the MaximumRecords command on the Records menu is still available.



CAUSE
The MaxRecButton property applies only to the navigation buttons on the form. It does not apply to the MaximumRecords command on the Records menu.



RESOLUTION
Use either one of the following methods to work around this behavior.

Create a Custom Menu for the Form
You can work around this behavior by creating a custom menu for the form that does not include the MaximumRecords command, and then setting the MenuBar property of the form in Design view to the name of your custom menu.

For more information about creating a custom menu, click Microsoft Access Help on the Help menu, type how do I create a custom menu in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

For more information about attaching a custom menu to a form, click Microsoft Access Help on the Help menu, type how do I attach a menu to a form in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

Use Custom Visual Basic for Applications (VBA) Code to Disable the Maximum Records Command
You can either hide or disable the Maximum Records command by using the Microsoft Office CommandBar object model.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. The following example demonstrates how to hide the menu command when the form is activated, and how to show the menu command when the form is deactivated.

 Open the sample project NorthwindCS.adp. Close the Main Switchboard form if it appears. On the View menu, point to Database Objects, and then click Forms. In the Database window, click the Customers form, and then click Design. On the View menu, click Code to view the module of the form. On the Tools menu, click References.</li> Click to select the Microsoft Office 10.0 Object Library check box.</li> Click OK to close the References dialog box.</li>  Add the following custom VBA code to the module of the form: Private Sub Form_Activate Dim cBar As Office.CommandBar Dim cBarCtl As Office.CommandBarControl

Set cBar = Application.CommandBars(&quot;Menu Bar&quot;) Set cBarCtl = cBar.Controls(&quot;Records&quot;).Controls(&quot;Maximum Records...&quot;)

'Hide the Maximum Records menu command cBarCtl.Visible = False

'Alternatively you could use this line to disable 'the command without hiding it  'cBarCtl.Enabled = False

Set cBarCtl = Nothing Set cBar = Nothing End Sub

Private Sub Form_Deactivate Dim cBar As Office.CommandBar Dim cBarCtl As Office.CommandBarControl

Set cBar = Application.CommandBars(&quot;Menu Bar&quot;) Set cBarCtl = cBar.Controls(&quot;Records&quot;).Controls(&quot;Maximum Records...&quot;)

'Show the Maximum Records menu command cBarCtl.Visible = True

'Alternatively you could use this line to enable 'the command without hiding and showing it  'cBarCtl.Enabled = True

Set cBarCtl = Nothing Set cBar = Nothing End Sub

</li> On the File menu, click Close and Return to Microsoft Access.</li> On the File menu, click Save, and then close the form.</li> In the Database window, click the Customers form, and then click Open.</li> Click the Records menu.</li></ol>

Note that the Maximum Records command on the Records menu is not available.

<div class="status_section">

STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

<div class="moreinformation_section">

Steps to Reproduce the Behavior
CAUTION: If you follow the steps in this example, you modify the sample Access project NorthwindCS.adp. You may want to back up the NorthwindCS.adp file and follow these steps on a copy of the project.


 * 1) Open the sample project NorthwindCS.adp.
 * 2) Close the Main Switchboard form if it appears.
 * 3) On the View menu, point to Database Objects, and then click Forms.
 * 4) In the Database window, click the Customers form, and then click Open.
 * 5) Note that the right-most navigation button at the bottom of the form is the Max Records button. The Max Records button has a caption that looks as follows: >|.... This button allows you to set the maximum number of records that are retrieved by the form.
 * 6) Click the Records menu. Note that it has a command that is named Maximum Records that also allows you to set the maximum number of records retrieved by the form.
 * 7) On the View menu, click Design View.
 * 8) On the View menu, click Properties to display the property sheet for the form.
 * 9) On the Other tab, set the MaxRecButton property to No.
 * 10) On the File menu, click Save, and then close the form.
 * 11) In the Database window, click the Customers form, and then click Open. Note that the Max Records navigation button is unavailable at the bottom of the form as expected.
 * 12) Click the Records menu.

Note that the Maximum Records command is still available, even though you set the MaxRecButton property of the form to No.

Additional query words: pra maxrecbutton project adp grey gray navigation form datasheet dimmed greyed out grayed

Keywords: kbbug kbnofix KB282370

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.