Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

disable shift key

Status
Not open for further replies.

andyukcy

Technical User
Jul 9, 2003
64
0
0
I know this is mentioned a lot of times .. and you ppl gave the same solution over and over again .. however, as the solution is so simple, it is easy for someone knowing access to find the way to enable the shift key again.

Is there a way to further secure the database? I have also locked the code with a password .. but what worries me is for someone to get into the design view of my forms and delete my logo for example and place his .. or something like that!:)

What do u think?
 
Are you asking how to disable the user's ability to use the shift bypass option, or have you already done that? If you have not here is one way.

Code:
Function ChangeProperty(strPropName As String, _
 varPropType As Variant, varPropValue As Variant) As Integer
'

 Dim dbs As DAO.Database
 Dim prp As DAO.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
Public Sub subSetAdminProperties()
   ChangeProperty "AllowBypassKey", dbBoolean, False
   ChangeProperty "AllowFullMenus", dbBoolean, True
   ChangeProperty "AllowSpecialKeys", dbBoolean, True
   ChangeProperty "AllowBreakIntoCode", dbBoolean, True
End Sub

Public Sub subSetUserProperties()
   ChangeProperty "AllowBypassKey", dbBoolean, False
   ChangeProperty "AllowFullMenus", dbBoolean, False
   ChangeProperty "AllowSpecialKeys", dbBoolean, False
   ChangeProperty "AllowBreakIntoCode", dbBoolean, False
   ChangeProperty "StartupShowDBWindow", dbBoolean, False
   ChangeProperty "", dbBoolean, False
End Sub
 
This is what I did:

1. On a very unlikely control I added a code to toggle the "AllowBypassKey" value only when you press a certain combination of keys (e.g. Ctrl+Shift+1). Use the MajP's example or the one in the Help file. It's better to toggle it than to just reset it without any possibility to change it back.

2. Of course, as the above example shows, I took out all those cuties from the StartUp options so it starts with a custom form instead of the db window, with no menus or special keys.

3. compiled the database in an mde. As you probably know you can't change the code in an MDE. It looks like right now there are some tools to allow changing the design of a form in MDE but not the code.
Make sure you keep a copy of your MDB file as that's the only one you can change. Every time you distribute another version of your project you will compile it from the MDB and only distribute the MDE.

3. to further secure the project I applied user-level security. Anybody logging in with the admin user can't open the file.

4. I've created another user that has all permissions on the application and saved the workgroup in a separate file. You'll have to distribute the workgroup file with your mde.

5. I've created a tiny VB.NET program that opens the mde file providing the workgroup file, username and password. You can use more parameters for exclusive mode and so on. Of course, you need to distribute this program as well.

The end user only opens the exe file, it doesn't need to know the user or password for your mde. The exe does all this.
If one wants to open the db directly one needs the user and password from the workgroup.
Assuming the workgroup is cracked (with one of the few tools available out there), they will have access to a file having the Shift disabled. Unless you tell anybody I really doubt that somebody will discover that combination on that specific control to remove the Shift bypass.
Assuming somebody does that they'll have access to a compiled file without the possiblity of seeing the code.
Even if they want to change only the design of the form they'll need another piece of software to do that.

That's the best I could come up with. I'm sure there must be other ways but this works fine for my application.
I hope this helps.
 
How are ya andyukcy . . .

Is it worth breaking into your DB to do what you've indicated?

Calvin.gif
See Ya! . . . . . .
 
Make and distribute an mde file. No one can get into your code or change any of your forms. However, before doing so, make sure you save a copy of the mdb file or you will have prevented yourself from getting in also.


Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top