I want to disable function keys in access 2010,for that i am using code on forms on key down event.
Code is -
'The forms Key Preview property must be set to Yes
-
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
-
-
Select Case KeyCode
-
Case vbKeyDelete
-
MsgBox "The Delete key was Pressed"
-
KeyCode = 0
-
Case vbKeyF1
-
MsgBox "The F1 key was Pressed"
-
KeyCode = 0
-
Case vbKeyF2
-
MsgBox "The F2 key was Pressed"
-
KeyCode = 0
-
Case Else
-
'MsgBox "No match!" 'testing
-
End Select
-
-
End Sub
-
This works well but i want to create module and that module will be called in startup form and it will be applicable to call forms and reports.
Is it possible
Thank you in advance
I would suggest a slight modification.
TrapFunction() should, indeed, be a function procedure, rather than a subroutine procedure as shown.
The call to it should assign KeyCode to the result. - Public Function TrapFunction(KeyCode As Integer) As Integer
-
'blah di blah
-
TrapFunction = {whatever}
-
End Function
- Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
-
KeyCode = TrapFunction(KeyCOde)
-
End Sub
The rest of the post (#2) is well worth checking out too, as it deals with a very powerful technique to help secure your databases.
3 6640 zmbd 5,501
Expert Mod 4TB
Create the procedure in a standard code module using parameter, for example - sub trapfunction(byval keydown as Integer)
-
'remaining code omitted (^_^)
Then for each form where you want to trap the function keys in the Keydown event, call the procedure - Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
-
Call trapfunction(KeyCOde)
-
End Sub
There is also the AutoKeys macro... it is one of the only special case macros I use as I trap the [F1] and [F11] keys using this macro, even if the bypass key is used, the AutoKeys macro usually works.... be very careful using this macro as you can lock yourself out of things you need.
NeoPa 32,556
Expert Mod 16PB
I would suggest a slight modification.
TrapFunction() should, indeed, be a function procedure, rather than a subroutine procedure as shown.
The call to it should assign KeyCode to the result. - Public Function TrapFunction(KeyCode As Integer) As Integer
-
'blah di blah
-
TrapFunction = {whatever}
-
End Function
- Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
-
KeyCode = TrapFunction(KeyCOde)
-
End Sub
The rest of the post (#2) is well worth checking out too, as it deals with a very powerful technique to help secure your databases.
zmbd 5,501
Expert Mod 4TB
after reading Neopa's suggestion, the function certainly makes more sense. I was only thinking about trapping the key, and not what to do withit afterwards.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Derek White |
last post by:
Ok here's the deal.
We are finally getting DSL again...
but our PC is in the living room... and the youngest has figured out
that if he hits the right keys... he can bring up Internet Explorer....
|
by: Armando |
last post by:
Apologies if this has been covered recently - I lurked and saw nothing.
I have an application that does ticketing at a three-screen movie theatre,
and I'm using the function keys F1 thru F12...
|
by: jaad |
last post by:
Hello,
I have a database that was written in access 2007 on my pc. I wanted to work off site with the database so I uploaded it onto my laptop which is loaded with access 2010 beta.
When I...
|
by: LaGena White |
last post by:
I need to obtain the sum (BillTotal)of InvoiceTotal plus DeliveryCharge. That is easy. I must also use IIF function to add $5.00 to BillTotal if delivery was made in a certain City, otherwise just...
|
by: jbrumbau |
last post by:
Hello,
In Access 2010/2007, how do you prevent users from flipping into design view from the ribbon? I do not want to hide the entire ribbon (DoCmd.ShowToolbar "Ribbon", acToolbarNo) or even the...
|
by: billwilson |
last post by:
IS there a way to disable the Access 2010 Hyperlink Security warning(s) without changing the registry?
If not, is the registry change the same as 2007?
I am running XP.
Thanks in advance,
...
|
by: beacon |
last post by:
Hi everybody,
My title may not exactly describe my issue, so please forgive my lack of creativity today.
I've got a database that was created in Access 2003 that I've opened in Access 2010. I...
|
by: twinnyfo |
last post by:
Hey coders,
Has anyone heard anything about the Date() function no longer working (or working differently in MS Access 2010? I have an MS Access 2007 DB that has worked perfectly, however, we...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |