ACC: DblClick Event Does Not Seem to Work

Last reviewed: May 30, 1997
Article ID: Q164788
The information in this article applies to:
  • Microsoft Access versions 7.0, 97

SYMPTOMS

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

Certain actions you perform in the DblClick event of a form control do not appear to do anything. For example, if you set the OnDblClick property of a text box control to a macro or Visual Basic procedure that is supposed to select all of the text in the control, it appears not to work correctly.

CAUSE

When you double-click a word in Microsoft Access and in many other Windows applications, the word you double-click is selected. Microsoft Access processes the event procedure or macro for the DblClick event, and then Windows selects the word you double-clicked. This makes it appear as though the code or macro did not run.

RESOLUTION

You can cancel the DblClick event after it executes your Visual Basic code or macro. This prevents Windows from processing its own double-click event. For example, the following Visual Basic code and sample macro selects all the text in a text box control, and then cancels the DblClick event:

In a Visual Basic for Applications Procedure

   Private Sub Text1_DblClick(Cancel As Integer)
      SendKeys "{F2}"
      Cancel = True
   End Sub

In a Macro

   Macro Name: Test

    Action
    -----------
    SendKeys
    CancelEvent

    Test Actions
    -------------------
    SendKeys
       Keystrokes: {F2}
       Wait: No
    CancelEvent

STATUS

This behavior is by design.

REFERENCES

For more information about the DblClick event, search the Help Index for "DblClick event."


Additional query words: double click dbl-click fire trigger execute
Keywords : FmsEvnt kbusage
Version : 7.0 97
Platform : WINDOWS
Hardware : x86
Issue type : kbprb
Resolution Type : Info_Provided


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.