Send A Double Click using code

CollinU

New member
Local time
Yesterday, 18:16
Joined
Jul 13, 2011
Messages
2
Is there any way to execute a dblclick by using code. In the following code I allow the used to choose to instert an object if they respond yes but want to trigger a dblclick even if they do not.

Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Do you want to Insert an Object ?" ' Define message.
Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
Title = "Insert Object Option" ' Define title.
Help = "DEMO.HLP" ' Define Help file.
Ctxt = 1000 ' Define topic
' context.
' Display message.
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' User chose Yes.
DoCmd.RunCommand acCmdInsertObject
Else ' User chose No.
' here i want to trigger the double click command'
Send DblClick
End If
 
I don't believe you can actually raise the event, but you can call the procedure that would handle the event, so if you have a subroutine ...
Code:
Private Sub SomeControl_DoubleClick()
[COLOR="Green"]  'your some control double click handler code here[/COLOR]
End Sub
... that is an event handler for a control, other subroutines can call this routine, so...
Code:
  If Response = vbYes Then
    DoCmd.RunCommand acCmdInsertObject
  Else
    SomeControl_DoubleClick
  End If
If you want other objects to have access to this routine you can declare it ...
Code:
[B][COLOR="DarkRed"]Public[/COLOR][/B] Sub SomeControl_DoubleClick()
End Sub
Hope this helps,
Mark
 
Thanks for the reply. This did not quite work but it triggered the answer and is greatly appreciated. This in a bound object control. I ended up changing the code and moving it into the double click property. Below is an overall explanition of my situation if you are interested. I have some knowledge of Access 2000 and am new to Access 2010. Sometime the simplest things are beyond me. Thanks to your reply I realize you can not directly trigger the code. In this case I had no code that I build to trigger the double click handler code , it is a built in funcion of the Control.


My problem starts when I share the database with others who are using the Accress 2010 runtime. Normally you can right click on the field and select to instert an object or doubleclick to open and view it. In the runtime you do not have the righclick option so you can select to insert an object. Now on double click I ask if they want to instert an object and if the answer is yes I trigger the insert and if no I simply End If then End Sub. The normal double click action of opening the object to view triggers.

Private Sub Document_DblClick(Cancel As Integer)
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Do you want to Insert an Object Select No To View Existing Object?" ' Define message.
Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
Title = "Insert Object Option" ' Define title.
Help = "DEMO.HLP" ' Define Help file.
Ctxt = 1000 ' Define topic
' context.
' Display message.
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' User chose Yes.
DoCmd.RunCommand acCmdInsertObject ' Perform some action.
Else ' User chose No.
End If
End Sub

Again I want to thank you, It is great to have people out there who are willing to help out and share their knowledge.
 

Users who are viewing this thread

Back
Top Bottom