UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Disabling Just F11, Access 2010    
 
   
dmhzx
post Dec 14 2015, 08:32 AM
Post#1



Posts: 7,033
Joined: 22-December 10
From: England


Hi folks, I'm not sure if this is the right forum for this one.

What I'm after is a method that will effectively ONLY disable the F11 key to display the Navigation pane.

This can be either by turning them all off via the Access special keys checkbox, and then using code to enable the others, or using code just to disable the F11 key.

(Can Access for example re-assign F1 to something completely different, or nothing at all when the application starts)

I have a pretty good bunch of Users, and I've just put in forms that will audit changes field by field and action by action for those I'm interested in. By opening the tables with a form in datasheet view I can lock some fields, hide others, and audit the ones they should be able to change.

I'm just looking for a way to wean them off F11.

How hard is it?

Thanks

David
Go to the top of the page
 
RAZMaddaz
post Dec 14 2015, 09:07 AM
Post#2


UtterAccess VIP
Posts: 9,522
Joined: 23-May 05
From: Bethesda, MD USA


David,

Please try the following:

Go into "Access Options," and click on "Current Database." Next scroll down and deselect "Display Navigation Pane." Then, just under the "Display Navigation Pane," click on the "Navigation Options..." button. Select the "Object Type" on the left side and then deselect the Forms check box and any other Group you don't want your User(s) to see.

Before you any of this, make a back up copy of your database, just in case.

One more important thing, in order for you to see the Navigation Pane again, you will need to hold down the "Shift" button when you open your database/file.

RAZMaddaz
Go to the top of the page
 
dmhzx
post Dec 14 2015, 09:14 AM
Post#3



Posts: 7,033
Joined: 22-December 10
From: England


Thanks Raz:
Sorry I wasn't clear enough.
I can hide and show the nav pane using a couple of 'secret' buttons, what I'm after is stopping anything from happening if they press F11 - Which is one of the set of 'special keys'.
Access allows me to turn them all off (F11, AltF11, and Ctrl-Break, and another one I don't know!)
I'm happy with all th rest being enabled, I just don't want them to be able to open the Nav pane at all (But I can with my 'magic' buttons ---- and so would they if they knew where thy were)

I'd be happy if I could re-assign the F11 function to another key combination (which I wouldn't tell them!)
Go to the top of the page
 
RAZMaddaz
post Dec 14 2015, 09:45 AM
Post#4


UtterAccess VIP
Posts: 9,522
Joined: 23-May 05
From: Bethesda, MD USA


I know the suggestion I made earlier would still show the navigation pane, however none of the Forms, would be shown.

Here is a link to a function that I just found that will prevent Users from opening the Navigation Pane:

Show/Hide Navigation Pane

RAZMaddaz
Go to the top of the page
 
RAZMaddaz
post Dec 14 2015, 09:50 AM
Post#5


UtterAccess VIP
Posts: 9,522
Joined: 23-May 05
From: Bethesda, MD USA


QUOTE
I have a pretty good bunch of Users, and I've just put in forms that will audit changes field by field and action by action for those I'm interested in. By opening the tables with a form in datasheet view I can lock some fields, hide others, and audit the ones they should be able to change.


David,

Suggestion, if this is a shared database, then maybe the FE/BE type database is what you should be creating?

RAZMaddaz
Go to the top of the page
 
dmhzx
post Dec 14 2015, 10:33 AM
Post#6



Posts: 7,033
Joined: 22-December 10
From: England


Thanks Raz:
That second post with the function looks like just what I'm after.
I should be able to capture the F11 key and just run this:

DoCmd.NavigateTo "acNavigationCategoryObjectType"

DoCmd.RunCommand acCmdWindowHide

or very similar.

BTW:
It IS a FE/BE construct, and the audit log file is in a different back end to the DAT BE (if you get my drift).

This could be one of my very few Macros!

Thanks for the pointer.

David
Go to the top of the page
 
jleach
post Dec 14 2015, 10:42 AM
Post#7


UtterAccess Editor
Posts: 9,815
Joined: 7-December 09
From: Staten Island, NY, USA


I tend to dislike the AutoKeys macro because it doesn't handle ALT (thus not able to trap Alt+F4, which was a big one to me).

For a more robust solution, create a class module called GlobalKeyHandler (or whatever) and include the Access.Form as a WithEvents host:

(aircode)
CODE
Option Explicit

Private WithEvents host As Access.Form

Public Sub Init(frm As Access.Form)
  Set host = frm
  host.KeyPreview = True
  host.OnKeyDown = "[Event Procedure]"
End Sub

Public Sub host_KeyDown(KeyCode As Integer, Shift As Integer)
  'check all your keys and act accordingly here
End Sub



Then, in every form in the app, use this:

CODE
Option Explicit

Private keyHandler As GlobalKeyHandler

Public Sub Form_Load()
  Set keyHandler = New GlobalKeyHandler
  keyHandler.Init Me
End Sub

Public Sub Form_Unload()
  Set keyHandler = Nothing
End Sub



If you have template/boilerplate code for forms, this is very easy to include in all forms and covers every global key event you could want, while being able to check for CTRL, SHIFT, ALT or any combination thereof.

(in fact, this is a standard for me that's expanded to include many common, global shortcuts, etc).

(futher note that you can still use the form's native KeyDown event, but *you cannot be sure which of those two subscribed events will fire first, so be careful!*)

hth
Go to the top of the page
 
dmhzx
post Dec 14 2015, 11:49 AM
Post#8



Posts: 7,033
Joined: 22-December 10
From: England


Thanks for the suggestion:
For this particular need, the simple would do me nicely, but I'm a complete novice with Macros.
And I'm working with Access 2010, and the first instruction in the WIKI is no use at all!

But I have now tracked it down, and got this to work. The trick was 'sub macro' and the curly brackets!.


The Function is called "NoF11"
and runs this code
CODE
' DoCmd.NavigateTo "acNavigationCategoryObjectType"  (Note the commenting out!)
DoCmd.SelectObject acTable, "tbltime", True

DoCmd.RunCommand acCmdWindowHide

End Function


What I'd have liked is to have used an "if (something).visible then"
after
DoCmd.NavigateTo "acNavigationCategoryObjectType"

But couldn't find what the navigation was called, or how to test it for visibility. So in the end I changed from Navigate to, to Select Object.

Which now does just what I want - F11 hides the Nav pane (and nothing else).
And I've put code to make it visible again behind the double click of an invisible label in the header of the 'Utilities form'

Thanks again.
David
Go to the top of the page
 
Tryingtobuild4li...
post Apr 20 2016, 02:40 PM
Post#9



Posts: 14
Joined: 18-March 16



Thanks for providing this; this is what I needed for a DB I was working on. I searched other sites and this was the winner!
Go to the top of the page
 
dmhzx
post Apr 21 2016, 03:12 AM
Post#10



Posts: 7,033
Joined: 22-December 10
From: England


Thanks for the thanks hat_tip.gif
I always try to post solutions to my problems when I find them, for the very reason that it might help someone.

Let me know if you'd like any more details about the invisible label which allows me to show the NAv Pane.

David
Go to the top of the page
 
AlbertKallal
post Sep 20 2017, 02:50 PM
Post#11


UtterAccess VIP
Posts: 2,551
Joined: 12-April 07
From: Edmonton, Alberta Canada


The least amount of effort would simply to use a AutoKeys macro.

You just need this:

Submacro: {F11}
End Submacro

At this point F11 will do nothing.

You can also use the key down event for EACH form and this would only take one line of code. And you could even use "withevents" - but at seveal lines per form - rather high cost.
So I think having to modify EVERY form seems like a “too high” cost in place of AutoKeys macro.

Albert D. Kallal (Access MVP, 2003-2017)
Edmonton, Alberta Canada
kallal@msn.com
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    18th December 2017 - 09:51 AM