Question : Click event overrides DblClick event

I have a text box Comments with both Click and DblClick Events.  However, I find that as soon as I DoubleClick the mouse, the Click event kicks in.   So there is no way that the DblClick code ever happens.  Basically, when the user Clicks I want the ZoomBox to open.  When he DblClicks the Caclulator is displayed and whatever the result from the Calculator is is then appended to the existing Comments text.  
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
Private Sub Comments_Click()
    DoCmd.RunCommand acCmdZoomBox
End Sub
Private Sub Comments_DblClick(Cancel As Integer)
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    Me![txtkeep] = Me![Comments]
    Comments = Me![txtkeep] & " " & adhDoCalc()
End Sub

Answer : Click event overrides DblClick event

Yes, it seems so.

The ideas is as follows:

* When the click event occurs, nothing happens. Instead a timer is set, and if nothing else happens in the next 100 (or 250) milliseconds, the form's timer event will be triggered. This you did correctly.

* When the double-click event occurs, before the timer is done running, the timer is reset to 0 (and not to 250). This means the planned event will never occur. The timer goes back to sleep, and the double-click event does something. In my code it was just a message box, in yours it will be something more elaborate.

* When the timer ticks down to zero, 100 (or 250) milliseconds after the click event actually happens, and no double-click event to reset the timer, something can happen in the timer event. It first needs to set the timer interval back to zero, or it will be called again repeatedly (we don't want THAT!). In my code, it was just a message box, in yours it should contain the command to open the zoom box.

Does that help?
(°v°)
Random Solutions  
 
programming4us programming4us