Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable ESC or ctrl-z

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
hi, please help me!!!!!

I have a form with a record, if i write something in a field and i press ESC, undo the action, but if i again press the ESC inmeditatly, the record puts all in blank and erase all data in the fields.

How can i disable the ESC or the ctrl-z for the current record??????

thanksssss

:)
 
In the control event properties, use the KeyDown event to trap for these keys. KeyCode is NOT equivalent to ASCII values. I think you could probably use the enumerated constants as well (vbKeyEscape, vbKeyControl, vbKeyZ, etc).
To cancel the key, set keycode = 0 somewhere in your event code.

Just put your form in single step mode and see which values come in. Try something like the following:

Private Sub Ct_KeyDown(KeyCode As Integer, Shift As Integer)

If Shift = vbKeyControl and KeyCode = vbKeyZ Then
KeyCode = 0
Shift = 0 'Not sure if you need this or not
ElseIf KeyCode = vbKeyEscape Then
KeyCode = 0
End If

End Sub

Good Luck!
 
thanks a lot!!!!!!!!!!!1

your help was very important to me.

i resolved my problem...

again, thanks a lot.....


:=)))))))))))))))))))))))))))))))))))))))))))))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top