Results 1 to 10 of 10
  1. #1
    Join Date
    Jul 2003
    Posts
    9

    Cool Unanswered: Disable function keys

    Hi,

    I would like to know if there is a way to disable the function keys (F1, F11 etc) using a macro or VB code. The reason for this is to stop the database window appearing whenever the F11 key is pressed.

    Thanks.

  2. #2
    Join Date
    Jul 2003
    Posts
    5

    Re: Disable function keys

    I don't know it in vb, but in TOOLS, STARTUP, Advanced, select "Use Access Special Keys". This will disable the use of the Alt F11 and F11.

  3. #3
    Join Date
    Sep 2002
    Location
    Finland
    Posts
    34
    Hi,

    I use these lines to lock my access databases:

    Sub SetStartupProperties()

    ChangeProperty "StartupForm", dbText, "MainForm"
    ChangeProperty "StartupShowDBWindow", dbBoolean, False
    '' ChangeProperty "StartupShowStatusBar", dbBoolean, False
    ChangeProperty "StartupMenuBar", dbText, "MyOwnMenu"
    ChangeProperty "AllowBuiltinToolbars", dbBoolean, False
    ChangeProperty "AllowFullMenus", dbBoolean, False
    ChangeProperty "AllowBreakIntoCode", dbBoolean, False
    ChangeProperty "AllowSpecialKeys", dbBoolean, False
    ChangeProperty "AllowBypassKey", dbBoolean, False

    End Sub

    Sub UnSetStartupProperties()

    ChangeProperty "StartupForm", dbText, "MainForm"
    ChangeProperty "StartupShowDBWindow", dbBoolean, True
    '' ChangeProperty "StartupShowStatusBar", dbBoolean, True
    ChangeProperty "StartupMenuBar", dbText, ""
    ChangeProperty "AllowBuiltinToolbars", dbBoolean, True
    ChangeProperty "AllowFullMenus", dbBoolean, True
    ChangeProperty "AllowBreakIntoCode", dbBoolean, True
    ChangeProperty "AllowSpecialKeys", dbBoolean, True
    ChangeProperty "AllowBypassKey", dbBoolean, True

    End Sub


    I have two button in my MainForm; lock an unlock
    These buttos are visible only for me (users who have access to modify form). After you use these buttons you must reopen database.

    NOTE! When you have locked your database, you can unlock it only using unlock-button in your MainForm. If unlock-button are not visible you cannot access your code/design.

    You also need 'ChangeProperty'-function:
    Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
    Dim dbs As Database, prp As Property
    Const conPropNotFoundError = 3270

    Set dbs = CurrentDb
    On Error GoTo Change_Err
    dbs.Properties(strPropName) = varPropValue
    ChangeProperty = True

    Change_Bye:
    Exit Function

    Change_Err:
    If Err = conPropNotFoundError Then ' Property not found.
    Set prp = dbs.CreateProperty(strPropName, _
    varPropType, varPropValue)
    dbs.Properties.Append prp
    Resume Next
    Else
    ' Unknown error.
    ChangeProperty = False
    Resume Change_Bye
    End If
    End Function

  4. #4
    Join Date
    Jul 2003
    Posts
    9
    Thanks, I'll try this out.

  5. #5
    Join Date
    Jun 2003
    Posts
    11
    Is there a way to reprogram a function key for Access? For example, could you make F5 close a form?

  6. #6
    Join Date
    Sep 2002
    Location
    Finland
    Posts
    34
    Originally posted by MissR605
    Is there a way to reprogram a function key for Access? For example, could you make F5 close a form?
    Create a new makro and save it with the name AutoKeys.
    In the first row of the Macro Name column, enter {F5}.
    In the Action column beside this, choose RunCommand. Then in the lower pane, choose the command Close.

  7. #7
    Join Date
    Jun 2003
    Posts
    11
    You enter {F5} in the Conditions column?

  8. #8
    Join Date
    Sep 2002
    Location
    Finland
    Posts
    34
    Originally posted by MissR605
    You enter {F5} in the Conditions column?
    In Macro Name column, enter {F5}

    check Macro Names on the View menu

  9. #9
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    while this topics up can you disable Ctrl+F4 and the rest of the defalt windows commands (like Alt+Tab, Ctrl+Tab, Alt+F4)?
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  10. #10
    Join Date
    Jul 2003
    Posts
    9

    Thumbs down

    Hi.

    Some key combinations will work, for example ^{F4} in the macro name column will work when the ctrl + F4 function keys are used together. However, some keystrokes are disallowed for example,
    %{F4} (alt + F4) is not allowed as it is probably a Windows function rather that just application specific like in Access the F11 key will reveal the database window if hidden.

    Regards.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •