Completely Lock Database?

arvdot

Registered User.
Local time
Today, 05:18
Joined
Mar 13, 2009
Messages
21
Hi, I've designed a database system that I recently put into use. It's used by about twenty people. Now, I have security features linking it to LDAP on the login screen to prevent people from accessing it, but if someone were to know that by holding shift they can bypass this startup page, then get into the options of the database and unhide the navigation pane and restore all menu buttons, they could start editting data in the back end tables.

So, what I'm wondering is, is there any way to fully lock down an Access (2007) database. This would only allow the user to view forms and reports. They cannot access anything else, nor can they get into an options menu to eliminate the protection. I have a seperate copy of the database (accdb) that I use for editing, and lock down when I replace the older one, so it's no issue for me if I cannot "Unlock" the database.
 
I think I may have found something deep in the forums that can answer my question. If it doesn't work though, I will bump this. So for now, ignore please:)
 
Okay. I've looked through the forums and have found a bunch of stuff on automating the hiding of toolbars and menus on startup. One problem though...I cannot find a way to hide the Option to "Customize Quick Access Toolbar" (right click on the ribbon and it will come up). So long as this is still availabe in my database, anyone can go in and display all the information. Does anyone know how to hide this option? Or could anyone point me in the right direction. Thanks!
 
...And Naturally of course, I have found the solution to my problem. If anyone cares, this will hide EVERYTHING on the top. This will truly Lock Down your data base:

Private Sub LockDown()
DoCmd.ShowToolbar "Ribbon", acToolbarNo
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars(i).Enabled = False
Next i
End Sub

The code might be a little redundant. But the first line is completely necessary, as the for loop will not account for it. The second line might not be though... But the for loop is neccesary.
 
Sorry but this is my LAST Reply to this! Turns out the For loop is completetly unnecessary. Just the two dsiables:

DoCmd.ShowToolbar "Ribbon", acToolbarNo
DoCmd.ShowToolbar "Menu Bar", acToolbarNo

If you do use the commandbars.enabled = false command you will disable your property sheet bar, even when you hold shift on start up. I learned this the hard way. So if you can't access your add existing fields or property sheet for any reason use set all your commandbars.enabled to True!
 
You were the only one who posted to your own questions with the answers but you got my problems resolved.....so THANKS!
 
Yeah, thanks from me, I've been looking for the same information and most answer I found were either too complex or didn't work. I tried your and it works like magic, now I just need to find codes for hiding the navigation pane. :D
 
If either of you are interested, here is a piece of code that will disable the by pass key , holding down shift, on start up. It's unnecessarily long, but I didn't write it, I found it a couple days ago; you can definitely shorten it if you desire. I don't know why, but all the suggested methods of disabling the bypasskey property didn't work for my database, but this one did. Just include this line in your main code:

ChangeProperty "AllowBypassKey", 1, False

And then here is the function:

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
 
And here's my bit about hiding and showing navigation pane using codes:

To hide the pane use:

DoCmd.RunCommand acCmdWindowHide

To Show the pane:

DoCmd.SelectObject acTable, , True


Both worked well for me. Convenient to use with a button so that only I can look at the tables when I want.
 
you already found your answer arvdot. play around with allowbypasskey. try it first on a sample database before using it on your actual program.
 
Where does this snippet of code go?

Sorry but this is my LAST Reply to this! Turns out the For loop is completetly unnecessary. Just the two dsiables:

DoCmd.ShowToolbar "Ribbon", acToolbarNo
DoCmd.ShowToolbar "Menu Bar", acToolbarNo

If you do use the commandbars.enabled = false command you will disable your property sheet bar, even when you hold shift on start up. I learned this the hard way. So if you can't access your add existing fields or property sheet for any reason use set all your commandbars.enabled to True!
 
I know this is an old thread, but I have used the code in this thread to lock down my 2007 database.

The problem I have now is as follows
1. The database opens by calling a form. As an event "On Open", I run the vba code of DoCmd.ShowToolbar "Ribbon", acToolbarNo
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
2. I then use the form to login into the system.
3. Once logged on, I have a form "Main" page, which contains buttons to run queries. I click a button, and for simplicity, the query is run and the results are displayed as a datasheet view.
4. I can now select all the data, and copy and past to say excel

The problem is I now want to run another query, so by theory return to the "Main" page. As eveything is disabled by the original code, I am only left with the 3 button in the top right hand corner, minimise, restore down, and close. Bascially i have the close and then re-enter the database

Any clues?

Thanks
 
Guys,

When I manage to bypass the shift-key, I can still import the tables and queries from the database through an external source. Any idea how to prevent this?

TiA,
Timo
 
There is no real way to prevent this. You can try hiding them so they are not visible to the external sources. If you are using A2007/A2010 you can rename the extension from .accde to .accdr and Access will prevent all design access to all objects but this is just a trick since all a person needs to do is to change the extension back and the objects are accessable again.
 

Users who are viewing this thread

Back
Top Bottom