Microsoft Knowledge Base Email Alertz

(207801) - 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...

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 207801 - Last Review: June 24, 2004 - Revision: 2.0

ACC2000: DblClick Event Appears to Not Work

This article was previously published under Q207801
Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

On This Page

SYMPTOMS

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 to not 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. 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 action prevents Windows from processing its own double-click event. For example, the following Visual Basic code and sample macro select all the text in a text box control, and then cancel 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    Action         Action Arguments
   ---------------------------------------------
     Test        SendKeys       Keystrokes: {F2}
                                Wait: No
                 CancelEvent    
				

REFERENCES

For more information about the DblClick event, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type dblclick event in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

APPLIES TO
  • Microsoft Access 2000 Standard Edition
Keywords: 
kbprb kbusage KB207801
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate