OnKeyPress = "=somefunction()" how function can receive the key pressed?
Posted on 2006-10-22
The event procedure for OnKeyPress starts:
Private Sub xxx_KeyPress(KeyAscii As Integer).
However when I change it to a function call:
OnKeyPress = "=somefunction()"
there does not seem to be a way to send the KeyAscii value to the function. Is there some way for the function to get the key pressed?
Why do I want this? To avoid having to write lots of keypress event subroutines. I have code that scans a form when it opens for certain comboboxes, and sets them up in certain ways. The only place I'm stuck is handling keypress.