Results 1 to 15 of 15

Thread: Coding F12

  1. #1
    Join Date
    Oct 2003
    Location
    London
    Posts
    341

    Unanswered: Coding F12

    Hey guys,

    Does anybody know how to code a specific Keyboard Key to run a command?

    I have disabled the bypass and hidden the main window so no-body can design my form the only problem with this is that I have to call the VB window, enable the bypass, close the database and restart the database in order to open it in design view.

    What I would like to do is always disable bypass and have a key press F12 that would open a password window which in-turn opens the DB window for design.

    Anyone got any ideas?

  2. #2
    Join Date
    Jun 2004
    Location
    Florida, US
    Posts
    521
    what I usualy do hide DB window and disable special function keys from startup. if I need to make a design change I keep pressing shif key while opening the database, which stops Access to autorun forms and puts database into design mode. you can't really protect your forms from editing with coded passwords unless you have user level security enabled. you can only password protect your VB code.
    ghozy.

  3. #3
    Join Date
    Oct 2003
    Location
    London
    Posts
    341
    What I'm trying to do is protect my code and designs but maintain access myself by use of a secret command.

    I have already hidden the database window,

    Passworded the Vb,

    Disabled the bypass, and

    diasbled the special access keys.

    This has ineffect stopped anyone from getting to the design or code.

    What I was wondering is if it would be possible to un-hide the database window seeing as I have disabled the F11 Key. Looking at what I have just done I can see that what I actually want is to convert the function behind F11 to run when I press F12 or similar.

  4. #4
    Join Date
    Jun 2004
    Location
    Florida, US
    Posts
    521
    the problem is you can't really hide database window. anyone who opens your database with pressing shif will have access to it. only way to stop people editing your forms is converting your database to mde file. but when you do that you lose your ability to edit them too.
    ghozy.

  5. #5
    Join Date
    Oct 2003
    Location
    London
    Posts
    341
    Bu I have already disabled the bypass key "Shift"

    therefore they do not have access to the window. I want a code that would un-hide this window.

  6. #6
    Join Date
    Feb 2004
    Posts
    533
    You should be able to apply security to your database using Access Security features. Create a Workgroup File (other than system.mdw) apply the workgroup to your database, setup permissions, with you as the administrative user with full access to manage the database.


    Here's a great tut on implimenting Access Security:
    http://www.headwaysystems.com/accessSecurity.htm
    ~

    Bill

  7. #7
    Join Date
    Jun 2004
    Location
    Florida, US
    Posts
    521
    Quote Originally Posted by christyxo
    Bu I have already disabled the bypass key "Shift"
    ...
    how did you do that? just out of cruosity.
    ghozy.

  8. #8
    Join Date
    Jan 2004
    Location
    Lancashire, UK
    Posts
    33
    In Access 97 there was an AutoKeys macro. You could use this to assign a function to any key combination you choose.

  9. #9
    Join Date
    Sep 2004
    Posts
    161
    I use this code for unhide the DB windows
    Code:
    Function AccesBase()
    
    
        'Affiche la fenêtre base de données
        DoCmd.RunCommand acCmdWindowUnhide
    
    End Function
    You see the DBWindows, but you have not access to the Access menu

  10. #10
    Join Date
    Oct 2003
    Location
    London
    Posts
    341

    SetByPassProperty

    Quote Originally Posted by ghozy
    how did you do that? just out of cruosity.
    Create a new module, with the following code

    Code:
    Public Sub SetBypassProperty()
    	Const DB_Boolean As Long = 1
    	ChangeProperty "AllowBypassKey", DB_Boolean, False
    	' To re-enable shift bypass change the above line to True, hold down CTRL-G and in the ensuing window type
    	' Call SetBypassProperty
    End Sub
     
    Private Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
    	Dim dbs As Object, prp As Variant
    	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
    You will need to run this code once before it will work.. Try:

    Call SetBypassProperty

    in the debug window.

    This code will shut down the ByPass function - Be warned though, if you disable the bypass and disable the database window you cant get in!

    I have included this code but enabled the F11 key to access the Passworded VB Code. As far as I've tested its unbreakable.

  11. #11
    Join Date
    Jun 2004
    Location
    Florida, US
    Posts
    521
    nice. thank you for explaining it. though I should still be able to import everything into another database I guess. I mean if I stuck with disabled shift key. am I wrong?
    ghozy.

  12. #12
    Join Date
    Sep 2004
    Posts
    161
    In the same way, another propertys you can change at the start :
    Code:
    Function ParamProprDémarrage(Vrai_faux As Boolean)
        ModifiePropr "StartupShowDBWindow", dbBoolean, Vrai_faux
        ModifiePropr "StartupShowStatusBar", dbBoolean, Vrai_faux
        ModifiePropr "AllowBuiltinToolbars", dbBoolean, Vrai_faux
        ModifiePropr "AllowFullMenus", dbBoolean, Vrai_faux
        ModifiePropr "AllowBreakIntoCode", dbBoolean, Vrai_faux
        ModifiePropr "AllowSpecialKeys", dbBoolean, Vrai_faux
        ModifiePropr "AllowBypassKey", dbBoolean, Vrai_faux
    
    End Function
    
    Function ModifiePropr(chNomPropriété As String, varTypeProp As Variant, varValeurProp As Variant) As Integer
        Dim bds As Database, prp As Property
        Const conErreurPropNotExist = 3270
    
        Set bds = CurrentDb
        On Error GoTo Change_Err
        bds.Properties(chNomPropriété) = varValeurProp
        ModifiePropr = True
    
    Change_Sortie:
        Exit Function
    
    Change_Err:
        If Err = conErreurPropNotExist Then   ' Propriété non trouvée.
            Set prp = bds.CreateProperty(chNomPropriété, _
            varTypeProp, varValeurProp)
            bds.Properties.Append prp
            Resume Next
        Else
            ' Erreur inconnue.
            ModifiePropr = False
            Resume Change_Sortie
        End If
    End Function
    Last edited by jepi; 09-28-04 at 08:18.

  13. #13
    Join Date
    Oct 2003
    Location
    London
    Posts
    341
    Quote Originally Posted by jepi
    I use this code for unhide the DB windows
    Code:
    Function AccesBase()
    
    
        'Affiche la fenêtre base de données
        DoCmd.RunCommand acCmdWindowUnhide
    
    End Function
    You see the DBWindows, but you have not access to the Access menu
    Hi Jepi,

    I've tried your code but I get the message

    Run-time error '2046':

    The command or action 'WindowHide' isn't available now.

    Can you help?

  14. #14
    Join Date
    Sep 2004
    Posts
    161
    I have put this syntax on an item Menu and for me is work

  15. #15
    Join Date
    Oct 2003
    Location
    London
    Posts
    341
    This is strange, no?

    Maybe its just the way I was using it. I have a command button on an Adminviewonly form which has the procedure behind it on 'on click'.

    I get the same for hide and unhide. I'll try on a menu as you said though.

    Do my settings in startup have anything to do with this? I've been checking and unchecking the Show DBwindow but it didn't help - any advice?

Posting Permissions

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