PDA

View Full Version : DblClick,DoCmd.OpenForm and SetFocus Going Mad!!



cornall
11-18-2008, 03:30 AM
Hi,

I have a control with a _DblClick event.

All this event does is call

DoCmd.OpenForm "myform"

I want to set the focus to myform but some event seems to fire after the _DblClick event and sets the focus back to the control that I double clicked!!!!

This only happens in access 2007 the focus sets perfectly in 2003.

I am going mad!!!! What event fires after the _DblClick event so I can set the focus there!

D

cornall
11-18-2008, 03:55 AM
I used

DoCmd.CancelEvent after my DoCmd.OpenForm "myform"

This fixed it but if anyone can explain if this is correct or why this is required that would be great.

cornall
11-20-2008, 11:37 AM
Anyone?

CreganTur
11-20-2008, 12:18 PM
Post the code so we can see what's going on.

DarkSprout
11-21-2008, 08:26 AM
This will shift the focus to the new form
DoCmd.SelectObject acForm, "frm_myform"
~ Or ~

Force the new form to be the only active form
DoCmd.OpenForm "frm_myform", , , , , acDialog
Code execution will also pause in the module/form that Called "frm_myform"