We’re working on taking a horrible Access database and moving it to SQL with a pretty web front end. This means pulling apart the forms based Access database they’ve provided to see what it does. All well and good, except the database they gave us had an auto run macro that presented a log on prompt instead of letting you see the tables/queries/forms.
No problem you might think, hold down shift when it loads to suppress the macro, and get in that way. Good idea, but in this case, not so! Unfortunately some wise-ass in their dev team had set the AllowBypassKey property of the database to False. That disables the shift key so you can’t get around the macro. Disaster!
Unless you’re a sneaky bastard. Which, by popular consensus, I am. Here’s how to get round it…
I created a new empty .mdb, for the sake of argument call it RemoveProtection.mdb. In this new database, create a new module, again I called this RemoveProtection. You might as well call them foo and bar for all it matters. Inside your shiny new module, paste the following code:
Function DisableShiftKeyBypass(strDBName As String) As Boolean Dim ws As Workspace Dim db As Database Set ws = DBEngine.Workspaces(0) Set db = ws.OpenDatabase(strDBName) Dim prp As DAO.Property db.Properties.Delete "AllowBypassKey" Set prp = db.CreateProperty("AllowBypassKey", dbBoolean, True, True) db.Properties.Append prp db.Properties.Refresh Set prp = Nothing Set db = Nothing End Function
Then hit Ctrl-G to bring up the Immediate window. In that, type:
and hit Enter.
Voila! The database is now unprotected and you can hold down shift to get to the tables.
And that, ladies and gentlemen, is why you shouldn’t rely on MS Access security to protect your data!