Jul 16 2006, 05:54 AM
I am looking for help, explanation of function SendKeys.
In my form I have text box in which I put an event, 'before update' like below:
Sub Form_beforeupdate(cancel as integer)
cancel = 1
Pressing ESC key in above function should cause that eventual change in text box will not be accepted and changes will be undo. Unfortunately ESC key is not pressed and I need to do it manually from keyboard.
What is wrong? Can anybody help me how to resolve this problem?
Jul 16 2006, 08:33 AM
Firstly I (and many others) will advise you to avoid sendkeys. They can be unreliable and dangerous if the right window/form/control doesn't have focus....
The code you posted will simple not allow the user input to be saved as you cancel the update of the control with cancel=1... what are you trying to accomplish?
Jul 16 2006, 11:38 AM
Thanks for reply,
Formula cancel=1 will not allow the user to make changes, but will not undo changes automatically. User will see error message and will have to press ESC. If he try to pas it over by closing form an error message will appear again and of course changes will be not saved.
However I want to avoid presenting error messages and making pressing ESC automatic.
Jul 16 2006, 12:26 PM
Cancel = True
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here