How to disable Function keys(f1 to F12) in access2007

I have a access2000 application and i must upgrade to 2007. In some forms function keys like f5 or f6 are used to open other forms or doing some tasks so i must disable the original function of each keys. I did a macro to fix the problem : ex: {f1} with action : stop the macro and the name of the macro is Autokeys. It works good however  i would know if it is possible to  code in vba the same thing. On EE i found some code but it's not working (db.Properties("AllowSpecialKeys") = False) . Thanks
Who is Participating?
Scott McDaniel (Microsoft Access MVP - EE MVE )Connect With a Mentor Infotrakker SoftwareCommented:
AutoKeys should work in 2007 also.
Ok123Author Commented:
Ty for your reply but, i have a startfunction after my autoexec macro, is it not better to insert some code in this area ?
DatabaseMX (Joe Anderson - Microsoft Access MVP)Connect With a Mentor Database ArchitectCommented:
The easiest way to disable any key, F1 or other is in the AutoKeys macro as follow:

Macro Name = the Key you want to trap.
Action = Beep

In the same manner, you can trap the Shift, Control and Shift/Control versions also ...
+KeyName    SHIFT + Key
^KeyName    CONTROL+Key

See attached image,
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You can use VBA, but you have to trap all keystrokes at the form level, and you cannot trap keystrokes on Tables or Queries using VBA. In short, the AutoKeys is the best method to use.
Ok123Author Commented:
Many thanks
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.