[AccessD] Access KeyCodes

Curtis, Andrew (WAPL) Andrew.Curtis at wapl.com.au
Fri May 4 02:38:33 CDT 2007


How about using the form's keydown event, write the keycode to a hidden
control on the form (hdenKeyCode) when a key is pressed anywhere on the
form, then use the onUpdate of the hdenKeyCode control to trigger your
pfKeyPress(Keycode) function using pfKeyPress(forms!myform!hdenKeyCode)?
I know its Friday here, give me a break :)


--andrew

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Max Wanadoo
Sent: Friday, 4 May 2007 3:25 PM
To: Access Developers discussion and problem solving
Subject: [AccessD] Access KeyCodes

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
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


This message and any attached files may contain information that is confidential and/or subject of legal privilege intended only for use by the intended recipient. If you are not the intended recipient or the person responsible for delivering the message to the intended recipient, be advised that you have received this message in error and that any dissemination, copying or use of this message or attachment is strictly forbidden, as is the disclosure of the information therein. If you have received this message in error please notify the sender immediately and delete the message.




More information about the AccessD mailing list