Execution of click events in subforms through the parent form

aref

New member
Local time
Today, 14:47
Joined
Jan 10, 2023
Messages
28
Hello
I encountered a problem to refer the events in the forms.

In the Frm_Main form, I have a subform called Child1, now I want the double click event of the cmd__ProjectA button
run (cmd__ProjectA_DblClick)

And on the other hand, I have another subform in child1 called chlid2 that I want to have the cmd_Project button click event as well. (cmd_Project_Click)

Please guide according to the attached sample.

Thanks
 
Did you try
Chil1.form.cmd_project_click
 
MajP gave you an answer, but I think I need to amplify a bit. He wasn't wrong about the single-click case, but there is a wrinkle for double clicks.

First, just to clarify why that works, the syntax involves the name of the sub-form control (NOT the name of the actual sub-form):

Code:
subformcontrol.Form.Cmd_Project_Click

Second, for double-clicks, there is a Cancel argument that would be automatically coded into the entry-point declaration. You must therefore supply the correct call or you would get a "wrong number of arguments" error.

Code:
Dim CancelArg as Integer

...

subformcontrol.Form.cmd_ProjectA_DblClick( CancelArg )
 
Agreed.

Anytime I have gotten to the point in my code where I find myself starting to write code to force/call other standard Form or Button events, I eventually admit to myself I have made some mistakes. Look for them and approach it differently
 
I have to add further, @aref , You may want to ponder the essence of the concept of having both a click and a double click event attached to a Button ........
 
I have to add further, @aref , You may want to ponder the essence of the concept of having both a click and a double click event attached to a Button ........

Good point, Isaac, since the difference between a click and a double click is controlled by an external Windows "click sensitivity" setting that could easily turn one double-click into two fast but distinct single clicks.
 
One could definitely spend quite a bit of time scratching one's head with both events, wondering why the double click event never occurs ... :p
 
Reminds me of this thread, where someone was trying to have both events at once, I think NG enjoyed it a bit too much!

 
I wrote a more detailed description of the issue in February 2022 here:-


I will eventually Blog this on my website!
Now you sound like Daniel ... :ROFLMAO:
 
I was referring to a recent ruckus in the Access forums that Daniel observed and then blogged about. If you can call a few sentences a blog article. Anyway. Didn't really mean much by it in any direction or another.
 

Users who are viewing this thread

Back
Top Bottom