Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Click to execute one event or double click to execute another

Status
Not open for further replies.

chiefvj

Technical User
Feb 4, 2005
73
US
Here is the situation...When I click on a control in one form... another form opens and a record is loaded in a table. Now... I would like to double click on the same control and delete the previous record that was loaded. The problem I'm having is that I never get to the double click event. The click event always executes first. Any help on this problem would be greatly appriciated...THANKs
 
in the click event you need to check if the second form is loaded, if it is do nothing. This will allow the double click to fire

Private Sub Text0_Click()
If currentproject.allforms("frmName").isloaded Then
MsgBox "click"
your code that opens the form
End If
End Sub

Private Sub Text0_DblClick(Cancel As Integer)
MsgBox "double click"
End Sub
 
thx for the early response. I gave your code a try...but I'm still havin problems...
 
What is your code?
What is your problem?
The code I provided is only conceptual, you have to incorporate the idea.
 
Here is the code fot the click and double click events..
*************************************
Private Sub dfld1_Click()
On Error GoTo Err_Command144_Click

Call Check_DDDate(dfld1) '**** this calls a function that opens a PopUp form..
"dfld1" is a date that is passed to the function.
the function then checks to see if that date is already in a table.****
Me!dfld1.BackColor = vbRed


Exit_Command144_Click:
Exit Sub

Err_Command144_Click:
MsgBox Err.Description
Resume Exit_Command144_Click

End Sub

'**************************************
Private Sub dfld1_dblClick(Cancel As Integer)
On Error GoTo Err_Command144_Click

Call Dcheck_dddate(dfld1)'***** This is a call to a function that that passes "dfld1" which is used in a delete query

Me!dfld1.BackColor = vbWhite

Exit_Command144_Click:
Exit Sub

Err_Command144_Click:
MsgBox Err.Description
Resume Exit_Command144_Click

End Sub



*****************************
here is what the delete query looks like

DELETE Tbl_DDdate.DDDate
FROM Tbl_DDdate
WHERE (((Tbl_DDdate.DDDate)=[Forms]![Frm_DDDate]![store_DDDATE]));


The problem is that there is no way to fire the double click event without the click event firing first.

thx.
 
Where have you tried to include MajP's suggestion?

HarleyQuinn
---------------------------------
Carter, hand me my thinking grenades!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before post
 
Thanks for the response...I finally got it to work with this coding....

Private Sub dfld35_Click(cancel As Integer)
On Error GoTo Err_Command144_Click
If dfld35_Cnt = 0 Then
dfld35_Cnt = 1
Call Check_DDDate(dfld35)
Me!dfld35.BackColor = vbRed ' this call loads
Else
dfld35_Cnt = 0
Call Dcheck_dddate(dfld35)' this call deletes
Me!dfld35.BackColor = vbWhite
End If
Exit_Command144_Click:
Exit Sub

Err_Command144_Click:
MsgBox Err.Description
Resume Exit_Command144_Click
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top