LPARAMETERS cCommand ... case cCommand == 'ESC' if p_confirm([Are you sure you want to abandon changes?]) thisform.release endif ...I can't explain how your solution works. Somehow, _DoCmd gets called with "ESC". Does Release call QueryUnload? If so, how does the above code run without becoming an endless loop when called from QueryUnload?
*Treeview Keypress LPARAMETERS keyascii if keyascii = 27 thisform._DoCmd('ESC') endifThe problem was, the confirm box popped up twice when I ran my code that way while your code worked. Can you help me understand what is happening here?
>* Treeview Keypress >*** ActiveX Control Event *** >LPARAMETERS keyascii >IF keyascii = 27 > Thisform.Release() >ENDIF >>>In our system, the escape key exits you out of a form back to the calling form. I just created a new form in which I use the MS treeview control. When the control has the focus and the user presses Esc, I just get an annoying beep. Apparently the form is never notified that the Esc key was pressed.