Re: Text Box Undo

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi,
Thanks for the help. The problem I face is when the user clicks Ctrl+Z
all the text typed in the Text box disappears. This is not intended as the
comments typed in are sometimes lengthy. If the user types comumunication
instead of communication and then presses Ctrl+Z the whole text he typed
before the word is also lost which is horrifying for the user.

I am also trying to save the record once the user presses spacebar through
which the user can get the desired result if he presses Ctrl+Z. I tried the
below code in which I have a problem. When I press the spacebar the cursor
moves to the beginning of the Text which is not intended.Your assistance is
greatly appreciated

If KeyCode = vbKeySpace Then
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveForm, , acMenuVer70

End If


Thanks
Kiran

"Linq Adams via AccessMonster.com" wrote:

Sorry, hit "Submit" too soon!

Having said that, one line

Keycode = 0

will correct your code:

Private Sub TextBoxName_KeyDown(KeyCode As Integer, Shift As Integer)
If Shift = acCtrlMask Then
Select Case KeyCode
Case 90
KeyCode = 0
MsgBox ("You have selected Ctrl Z")
Case Else
End Select
End If
End Sub


Linq Adams wrote:
I'm somewhat confused! Presumablt if the user enters incorrect data and
presses Control + Z it's because they want the data to disappear! What am I
missing here?

You should also note that one of the main points in having Windows compliant
apps is so that the same commands do the same things in all of them. Taking a
standard command away from experienced users is very user-unfriendly and apt
to aggravate them.


--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200905/1


.



Relevant Pages

  • Re: OnKey problem
    ... its the one that stops a character from being printed (usually used when one presses Shift, Ctrl or Alt is pressed in combination with a letter in order to stop the letter from appearing in the TextBox)... ... Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ... ByVal Shift As Integer) ... MsgBox "You pressed Shift+N" ...
    (microsoft.public.excel.programming)
  • Re: OnKey problem
    ... its the one that stops a character from being printed (usually used when one presses Shift, Ctrl or Alt is pressed in combination with a letter in order to stop the letter from appearing in the TextBox)... ... Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ... ByVal Shift As Integer) ... MsgBox "You pressed Shift+N" ...
    (microsoft.public.excel.programming)
  • Re: Whats wrong with keyCode and String.fromCharCode
    ... But onkeypress only made it work for IE. So I looked elswewhere in the code and keyCode is for IE, while Mozilla prefers charCode. ... var kCode; ... Make sure your algorithm can cope with the entry or removal of multiple characters without any key presses. ...
    (comp.lang.javascript)
  • Re: Page Down Key Action
    ... currentrecord. ... Private Sub Form_KeyDown ... Select Case KeyCode ... presses Page Down twice, the form goes to a new blank record which I want ...
    (microsoft.public.access.formscoding)