On Click and Double Clicks not operating correctly

Christine Pearc

Christine
Local time
Today, 06:08
Joined
May 13, 2004
Messages
111
Help! My On Click and On Dbl Click events are not behaving! All my command buttons have On Click events, none of them have any code for On Double Click. However, if a user double-clicks by mistake, SOME of the code associated with the On Click event runs, but not all of it.

Here's a sample On Click event (error events removed):

Code:
Private Sub cmdRespond_Click()

If DCount("[CARNum]", "qryRespondSearch") <> 0 Then
    DoCmd.OpenForm "Respond Search frm", acNormal
Else
    MsgBox "There are no open CARs.", vbInformation, "No Data"
End If

End Sub

Now, here's the weird part. If the user double-clicks instead of just clicking, the "DoCmd.OpenForm "Respond Search frm" part of the OnClick code runs, THEN "There are no open CARs" message box appears"!!!

As a test, I added code to the On Double Click event to make a message box appear, but it doesn't: the weird stuff happens. I've tried to step through the code with a watch on the double-click event but it is bypassed like it didn't happen. :confused:

Can someone urgently advise??

Christine
 
If you would like to use the onDoubleClick event, do not use the onClick event of the same control as well i.e. for one control either use the onClick or the onDoubleClick but not both.

In fact when you trigger the DoubleClick event you are automatically triggering the onClick event as well, so that's why you were encountering that problem.
 
Thanks for that, but perhaps I didn't explain the problem well enough. I only have the On Click event. However, if the user double-clicks, then the problem occurs, i.e. only *PART* of the On Click event happens.

Christine
 
which Access version you are using, because i tried something similar on my access and it worked perfectly, even when i double clicked. My Access is 2002, but i'm working on 2000 format.
 

Users who are viewing this thread

Back
Top Bottom