[AccessD] Access KeyCodes

Max Wanadoo max.wanadoo at gmail.com
Fri May 4 02:25:01 CDT 2007


Dear All,
In the ONKEYDOWN Event of a control on my form when using Event Procedures I
get the following code created:-

Private Sub R1C1_KeyDown(Keycode As Integer, Shift As Integer)
  Call pfKeyPress(Keycode) ' I then add in my function to call to handle the
key pressed by user
End Sub

However, I have 81 such controls in a 9x9 grid and the above code is
repeated 81 times and I would like to remove all this

and replace them all with a direct call to a function, for example if I
wanted to call my own procedure to handle form events I

normally use the following format in the ONEVENT that I was interested in,
eg ONENTER:-

=pfSetStartPoint(Form) 'in here would be my code to handle the control that
had, in this example, been entered.


Access understands and  passes the value of (Form) which is the name of the
current form.  This means there is no code on

the form event and all code can sit in a public procedure which can be used
by any form that calls it.

My problem is that if I use the format =pfKeyCode(KeyCode) to replace the
ONKEYDOWN Event it complains that it does not

contain the automation value of KeyCode.  It DOES understand (Form) but not
(KeyCode).
Does anyone know how to get the value of KeyCode?

Thanks
Max



More information about the AccessD mailing list