Holding down Shift

More Info,

I have just been trying a few things and have come across the following:

If I select the command button and enter the correct password then the DB will allow me to bypass the Startup options every time I opent he DB. However if i then click ont he command button again and enter an Incorrect password then it does not allow me to bypass the startup options.

Is this the way it is meant to work?

If it is correct, then is there a way in which i can get it to revert to blocking the use of the Shift key the next time round? so that the password would be required again? or a way of re-enabling the code?

Thank you
Bev
 
You have to put the command button on a form. The form has to be the once specified in the startup. The code does work
 
teiben said:
You have to put the command button on a form. The form has to be the once specified in the startup. The code does work


I am happy with the button being on a form and i am happy that the code works.

What i am saying is that once i have entered the password to unlock the shift key, It DOES NOT revert to being locked afterwards unless i access the button again and input an incorrect password.

Bev
 
Is it possible to import the database objects into another db, if the objects in the former are hidden and its hidden attribute can not be changed as the menu bar is disabled? Experts please answer
 
C+S+S not working when imported

Hi all

Firstly, the examples in this thread are great, just what I have been looking for.

question regarding the post below

kybb1 said:
If you download the sample on my post, all you have to do is:

In your db, go to tables, select IMPORT tables, find the sample db that you SHOULD have downloaded, select the modules and the macro.

Once those are in there security is taken care of. From here, if you want to Bypass the Shift key, hit Ctrl+Shift+S, if you want to Allow the Shift key, hit Ctrl+Shift+G.

All you have to do....no special buttons, forms, hidden anything....very easily done.

If you need any further help, just post back....just remember to download the sample first.

Hope this is what you're looking for.

I took the password ("PW2") out of the VB code (as it wouldn't let me import the modules with the password on). The code works to enable/disable the shift key in my test db but the Ctrl+Shift+S/G keys do not work.

How do I get the Ctrl+Shift+S/G keys to work in my db?


Cheers

Kev.
 
I'm a bit confused as to where to call these functions. I copied your Public Function "SetProperties" into a new module. But I don't understand where it would be called from and where do I put the bDisableBypassKey button? on a new form or an existing form. I'm sorry if I seem slow but I'm lost with how this will work.


The below function and command button code will allow you to use a password
protected input box to determine if the Shift key can be disabled or not.

You might have to set your "References" to DAO 3.6. When you are viewing
the module, click the Tools menu >>> References >>> and Browse for Microsoft
DAO 3.6 >>> Select "Files of type: Executable Files (*.exe; *.dll)"
My DLL was located @ C:\Program Files\Common Files\Microsoft Shared\DAO.

Copy this function into a new public module.
Code:
Public Function SetProperties(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
On Error GoTo Err_SetProperties
    
    'Dim db As Database, prp As Property
    Dim db As DAO.Database, prp As DAO.Property
    
    Set db = CurrentDb
    db.Properties(strPropName) = varPropValue
    SetProperties = True
    Set db = Nothing
    
Exit_SetProperties:
    Exit Function
    
Err_SetProperties:
    If Err = 3270 Then 'Property not found
        Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)
        db.Properties.Append prp
        Resume Next
    Else
        SetProperties = False
        MsgBox "Runtime Error # " & Err.Number & vbCrLf & vbLf & Err.Description
        Resume Exit_SetProperties
    End If
    
End Function
Assign this to the OnClick event of a command (transparent?) button named "bDisableBypassKey".
Change the "TypeYourPasswordHere" default password.
This sub ensures the user is the programmer needing to disable the Bypass Key.
You can not format an Input Box!
Code:
Private Sub bDisableBypassKey_Click()
On Error GoTo Err_bDisableBypassKey_Click
    
    Dim strInput As String
    Dim strMsg As String
    
    Beep
    strMsg = "Do you want to enable the Bypass Key?" & vbCrLf & vbLf & "Please key the programmer's password to enable the Bypass Key."
    strInput = InputBox(Prompt:=strMsg, Title:="Disable Bypass Key Password")
    
    If strInput = "TypeYourPasswordHere" Then
        SetProperties "AllowBypassKey", dbBoolean, True
        Beep
        MsgBox "The Bypass Key has been enabled." & vbCrLf & vbLf & "The Shift key will allow the users to bypass the startup options the next time the database is opened.", vbInformation, "Set Startup Properties"
    Else
        Beep
        SetProperties "AllowBypassKey", dbBoolean, False
        MsgBox "Incorrect ''AllowBypassKey'' Password!" & vbCrLf & vbLf & "The Bypass Key was disabled." & vbCrLf & vbLf & "The Shift key will NOT allow the users to bypass the startup options the next time the database is opened.", vbCritical, "Invalid Password"
        Exit Sub
    End If
    
Exit_bDisableBypassKey_Click:
    Exit Sub
    
Err_bDisableBypassKey_Click:
    MsgBox "Runtime Error # " & Err.Number & vbCrLf & vbLf & Err.Description
    Resume Exit_bDisableBypassKey_Click
    
End Sub
HTH
 
You can place the bDisableBypassKey "hidden" button onto your main start up page, this way it's available to you as soon as you open your Db. The second piece of caode goes on the "On Click" property of the hidden button. It's very straight forward if you go through exactly the steps stated on the 2nd reply.
 
ghudson,

I am very interested in utilizing your code but am a bit unsure of how it actually works and where to put it? I know how to assign the sub to the OnClick event of a command button but where should this command button be located? Should I place it on a form and if so should that be my startup form or will it find it? If it finds it does it need to be named something in particular? And finally, will this always pop up or will it only pop up when the Shift key is pressed when you are logging onto a "secured" database or will it pop up after the normal security input box? Sorry for all of the questions, just want to make sure I do this right!

Thanks!
 
joeyo34 - The button should be located on your startup form.
It needs to be called bDisableBypassKey.
The password box will only show if you click the button, then you'll need to restart the Db holding the shift button down. When you have made the required changes you can then go back to your start up screen, click the button again and enter an INCORRECT password, this will then give the message that the shift key has been disabled.
I hope that clears a few things up for you. It works ok if you following the procedure to the letter. Good luck.
 
Thanks!

Matt,

That clears it up perfectly. I was having a difficult time picturing in my head how to disable the key before entering the database. I now realize that it disables the key at all times except when you put in the password to disable it then log off and log back in again. Thank you for the clarification, it is much appreciated!
 
Hi there,
Firstly i would like to thank you for the shift key security and bypass code you have posted on this forum it is very good indeed and works great

The only problem i am having is that on my pc it works fine but on my laptop when i run it if i enter the wrong password or press cancel then it locks it but when i enter the right password it gives an error something along the lines of refernce or function is invalid and gives the error 5 i have installed the dao3.6 but when you mention set to exectuable i dont get what you mean by that, do i have to add anything or what can i do to get rid of the error.
Am sorry if i sound a bit dim but am just a learner at the moment myself.

Thanks.
Regards
Naym
 
Ya...OK. Long Thread :) so I thought I may as well toss it out front again :D

Someone asked near the beginning of this thread.....

Thank you for the code, it works great.
Just want to know if there is a way to mark the password with (*)
Thanks
Newman

It can be done quite easily using a few Windows API functions. Here is a Sample...

.
 

Attachments

Users who are viewing this thread

Back
Top Bottom