Microsoft KB Archive/126866

= ACC2: Find Record Wizard Command Button Has Options Disabled =

Article ID: 126866

Article Last Modified on 7/5/2002

-

APPLIES TO


 * Microsoft Access 2.0 Standard Edition

-



This article was previously published under Q126866



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



SYMPTOMS
When you choose a Find Record command button that you created with the Command Button Wizard, the Search In option buttons and the Search Fields As Formatted check box are unavailable in the Find dialog box.



CAUSE
When you choose the command button, the command button receives the focus. The Search In option buttons and the Search Fields As Formatted check box are available only when the Find dialog box is invoked from a text box that is based on a field.



RESOLUTION
Add the following line to the code that is generated by the Command Button Wizard so that the focus is returned to the control that had the focus before you chose the command button:

  Screen.PreviousControl.SetFocus

To add this code, follow these steps:

 Open the form containing the command button in Design view. Use the right mouse button to click the command button that you created with the Command Button Wizard, and then choose Build Event from the menu that appears.  Add the following line as the second line of code in the module:

     Screen.PreviousControl.SetFocus

After you add the line, the code should be similar to the following sample code:

Sub ButtonX_Click Screen.PreviousControl.SetFocus On Error GoTo Err_ButtonX_Click

DoCmd DoMenuItem A_FORMBAR, A_EDITMENU, 10,, A_MENU_VER20

Exit_ButtonX_Click: Exit Sub

Err_ButtonX_Click: MsgBox Error$ Resume Exit_ButtonX_Click

End Sub  Save the form.</ol>

<div class="status_section">

STATUS
Microsoft has confirmed this to be a problem in Microsoft Access version 2.0. This problem no longer occurs in Microsoft Access version 7.0.

Keywords: kbbug kbusage KB126866

-

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

© Microsoft Corporation. All rights reserved.