X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Recognition Of Difference Double Click And Single Click, Access 2016    
post Jul 11 2018, 03:28 AM

Posts: 53
Joined: 9-June 18

Hi UtterAccess

Is there any Recognition of difference double click and single click

for the following reason:

I have found this article
a workaround, which utilizes the Form_Timer() event, if you're not already using the timer for something else on that form. Here's a sample:

Option Compare Database
Option Explicit

Private mblnDoubleClicked As Boolean

Private Sub cmdClicks_Click()
Me.TimerInterval = 200 'turn on timer
End Sub

Private Sub cmdClicks_DblClick(Cancel As Integer)
mblnDoubleClicked = True 'set flag
End Sub

Private Sub Form_Timer()
Me.TimerInterval = 0 'turn off timer

If mblnDoubleClicked Then
mblnDoubleClicked = False 'reset flag
MsgBox "Double Clicked"
'run 2-click code...
MsgBox "Single Clicked"
'run 1-click code...
End If
End Sub

But in our case we are using a OnTimer = 1000 in the properties of the form,
in order to update a clock

We have a second form, that does not use ontimer, so I will try there.

But wanted to find out if any other methods exist by members to distinguish in VBA.

We are using the double click to drill down from a crosstab query to a standard form.
And we are now attempting to use the drag/drop method on the same crosstab query to update, when the drop is detected.

Thank you kindly

While the single click
Go to the top of the page
post Aug 10 2018, 02:36 PM

Posts: 194
Joined: 9-September 11

just thinking out loud, use a module-level datetime var as a semaphore to assess whether we have a double-click, pseudo code would be something like (this may take some tweaking)

- key point is to alway reset datetime var to some old date, this is how we tell if we're dealing with a second click

on click
    'detect & act on a doubleclick
    'if there was a previous click
    if not (mydatevar=#1/1/2000 8am") then
    'and it is recent enough to be considered the first of two clicks
              if (now()-mydatevar) < (whatever interval is deemed a doubleclick) then
                        do double-click stuff
                        reset datevar to #1/1/2000 8am"
                        exit sub
    'not a double-click so fall thru          
    - set mydatevar=now              'set mydatevar to prepare for next click
    - do whatever single-click actions are needed - if any
       - key point - any single-click logic must reset datevar to #1/1/2000 8am" when done

goal is, if none of the single-click actions fire, then all we've done is set mydatevar, in anticipation of next click
This post has been edited by ChiliDog: Aug 10 2018, 02:46 PM
Go to the top of the page
post Aug 11 2018, 08:07 PM

Posts: 53
Joined: 9-June 18

Thank you very kindly for the response.

As soon as I have got something working, I will update.
Go to the top of the page

Custom Search
RSSSearch   Top   Lo-Fi    21st September 2018 - 01:27 AM